Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
3f259086
Commit
3f259086
authored
Sep 30, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove old workarounds + allow weakref of old style classes
parent
40c4e710
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
17 additions
and
26 deletions
+17
-26
from_cpython/Lib/StringIO.py
from_cpython/Lib/StringIO.py
+1
-3
from_cpython/Lib/UserDict.py
from_cpython/Lib/UserDict.py
+2
-3
from_cpython/Lib/csv.py
from_cpython/Lib/csv.py
+1
-3
from_cpython/Lib/email/errors.py
from_cpython/Lib/email/errors.py
+2
-5
from_cpython/Lib/encodings/__init__.py
from_cpython/Lib/encodings/__init__.py
+1
-3
from_cpython/Lib/tempfile.py
from_cpython/Lib/tempfile.py
+3
-6
from_cpython/Lib/types.py
from_cpython/Lib/types.py
+1
-2
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+1
-1
src/runtime/classobj.h
src/runtime/classobj.h
+2
-0
test/tests/weakrefs.py
test/tests/weakrefs.py
+3
-0
No files found.
from_cpython/Lib/StringIO.py
View file @
3f259086
...
...
@@ -39,9 +39,7 @@ def _complain_ifclosed(closed):
if
closed
:
raise
ValueError
,
"I/O operation on closed file"
# Pyston change: make this a new style class, looks like we don't support iterating otherwise
# class StringIO:
class
StringIO
(
object
):
class
StringIO
:
"""class StringIO([buffer])
When a StringIO object is created, it can be initialized to an existing
...
...
from_cpython/Lib/UserDict.py
View file @
3f259086
...
...
@@ -80,9 +80,8 @@ class IterableUserDict(UserDict):
def
__iter__
(
self
):
return
iter
(
self
.
data
)
# Pyston change: disable using the _abcoll module for now.
# import _abcoll
# _abcoll.MutableMapping.register(IterableUserDict)
import
_abcoll
_abcoll
.
MutableMapping
.
register
(
IterableUserDict
)
class
DictMixin
:
...
...
from_cpython/Lib/csv.py
View file @
3f259086
...
...
@@ -69,9 +69,7 @@ class excel_tab(excel):
delimiter
=
'
\
t
'
register_dialect
(
"excel-tab"
,
excel_tab
)
# Pyston change: make this a new style class, looks like we don't support iterating otherwise
# class DictReader:
class
DictReader
(
object
):
class
DictReader
:
def
__init__
(
self
,
f
,
fieldnames
=
None
,
restkey
=
None
,
restval
=
None
,
dialect
=
"excel"
,
*
args
,
**
kwds
):
self
.
_fieldnames
=
fieldnames
# list of keys for the dict
...
...
from_cpython/Lib/email/errors.py
View file @
3f259086
...
...
@@ -22,11 +22,8 @@ class BoundaryError(MessageParseError):
"""Couldn't find terminating boundary."""
# Pyston change: we don't support multiple inheritance yet, so this error class is tricky.
# We could make it so that it only inherits one of the base classes, but I'd rather that
# anyone who tries to use this error gets a loud error message rather than different behavior.
# class MultipartConversionError(MessageError, TypeError):
# """Conversion to a multipart is prohibited."""
class
MultipartConversionError
(
MessageError
,
TypeError
):
"""Conversion to a multipart is prohibited."""
class
CharsetError
(
MessageError
):
...
...
from_cpython/Lib/encodings/__init__.py
View file @
3f259086
...
...
@@ -43,9 +43,7 @@ _norm_encoding_map = (' . '
' '
)
_aliases
=
aliases
.
aliases
# Pyston change: we don't support multiple inheritance yet
#class CodecRegistryError(LookupError, SystemError):
class
CodecRegistryError
(
LookupError
):
class
CodecRegistryError
(
LookupError
,
SystemError
):
pass
def
normalize_encoding
(
encoding
):
...
...
from_cpython/Lib/tempfile.py
View file @
3f259086
...
...
@@ -29,8 +29,7 @@ __all__ = [
# Imports.
# Pyston change: don't import io
# import io as _io
import
io
as
_io
import
os
as
_os
import
errno
as
_errno
from
random
import
Random
as
_Random
...
...
@@ -198,10 +197,8 @@ def _get_default_tempdir():
fd
=
_os
.
open
(
filename
,
flags
,
0o600
)
try
:
try
:
# Pyston change: simplify this so that it doesn't need the _io module:
_os
.
write
(
fd
,
b'blat'
)
# with _io.open(fd, 'wb', closefd=False) as fp:
# fp.write(b'blat')
with
_io
.
open
(
fd
,
'wb'
,
closefd
=
False
)
as
fp
:
fp
.
write
(
b'blat'
)
finally
:
_os
.
close
(
fd
)
finally
:
...
...
from_cpython/Lib/types.py
View file @
3f259086
...
...
@@ -33,8 +33,7 @@ try:
except
NameError
:
StringTypes
=
(
StringType
,)
# Pyston change: 'buffer' is not implemented yet
# BufferType = buffer
BufferType
=
buffer
TupleType
=
tuple
ListType
=
list
...
...
src/runtime/classobj.cpp
View file @
3f259086
...
...
@@ -1599,7 +1599,7 @@ extern "C" PyObject* PyMethod_Class(PyObject* im) noexcept {
void
setupClassobj
()
{
classobj_cls
=
BoxedClass
::
create
(
type_cls
,
object_cls
,
&
BoxedClassobj
::
gcHandler
,
offsetof
(
BoxedClassobj
,
attrs
),
0
,
sizeof
(
BoxedClassobj
),
false
,
"classobj"
);
offsetof
(
BoxedClassobj
,
weakreflist
)
,
sizeof
(
BoxedClassobj
),
false
,
"classobj"
);
instance_cls
=
BoxedClass
::
create
(
type_cls
,
object_cls
,
&
BoxedInstance
::
gcHandler
,
offsetof
(
BoxedInstance
,
attrs
),
offsetof
(
BoxedInstance
,
weakreflist
),
sizeof
(
BoxedInstance
),
false
,
"instance"
);
...
...
src/runtime/classobj.h
View file @
3f259086
...
...
@@ -46,6 +46,8 @@ public:
BoxedTuple
*
bases
;
BoxedString
*
name
;
Box
**
weakreflist
;
BoxedClassobj
(
BoxedString
*
name
,
BoxedTuple
*
bases
)
:
bases
(
bases
),
name
(
name
)
{}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_o
)
{
...
...
test/tests/weakrefs.py
View file @
3f259086
...
...
@@ -48,6 +48,9 @@ test_wr(frozenset())
test_wr
((
i
*
i
for
i
in
range
(
1000000
)))
test_wr
(
set
)
test_wr
(
file
(
"/etc/passwd"
))
class
Old
:
pass
test_wr
(
Old
)
# missing: db cursor from the bsddb module
# missing: sockets
test_wr
(
array
.
array
(
'd'
,
[
1.0
,
2.0
,
3.14
]))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment