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
e03daee3
Commit
e03daee3
authored
Sep 30, 2015
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Oct 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc compatibility fixes
parent
ad8d03c3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
1 deletion
+16
-1
src/runtime/list.cpp
src/runtime/list.cpp
+2
-1
src/runtime/types.cpp
src/runtime/types.cpp
+1
-0
test/tests/list_subclassing.py
test/tests/list_subclassing.py
+2
-0
test/tests/none__class__.py
test/tests/none__class__.py
+2
-0
test/tests/str_adding.py
test/tests/str_adding.py
+4
-0
test/tests/str_adding_compat.py
test/tests/str_adding_compat.py
+5
-0
No files found.
src/runtime/list.cpp
View file @
e03daee3
...
@@ -786,7 +786,8 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
...
@@ -786,7 +786,8 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
}
}
Box
*
listAdd
(
BoxedList
*
self
,
Box
*
_rhs
)
{
Box
*
listAdd
(
BoxedList
*
self
,
Box
*
_rhs
)
{
if
(
_rhs
->
cls
!=
list_cls
)
{
if
(
!
PyList_Check
(
_rhs
))
{
return
NotImplemented
;
raiseExcHelper
(
TypeError
,
"can only concatenate list (not
\"
%s
\"
) to list"
,
getTypeName
(
_rhs
));
raiseExcHelper
(
TypeError
,
"can only concatenate list (not
\"
%s
\"
) to list"
,
getTypeName
(
_rhs
));
}
}
...
...
src/runtime/types.cpp
View file @
e03daee3
...
@@ -3864,6 +3864,7 @@ void setupRuntime() {
...
@@ -3864,6 +3864,7 @@ void setupRuntime() {
none_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneRepr
,
STR
,
1
)));
none_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneRepr
,
STR
,
1
)));
none_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneNonzero
,
BOXED_BOOL
,
1
)));
none_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
noneNonzero
,
BOXED_BOOL
,
1
)));
none_cls
->
giveAttr
(
"__doc__"
,
None
);
none_cls
->
tp_hash
=
(
hashfunc
)
_Py_HashPointer
;
none_cls
->
tp_hash
=
(
hashfunc
)
_Py_HashPointer
;
none_cls
->
freeze
();
none_cls
->
freeze
();
...
...
test/tests/list_subclassing.py
View file @
e03daee3
...
@@ -39,6 +39,8 @@ print MyList((1,2,3)) <= MyList((1,2,3))
...
@@ -39,6 +39,8 @@ print MyList((1,2,3)) <= MyList((1,2,3))
print
type
(
MyList
((
1
,
2
,
3
))
*
1
)
print
type
(
MyList
((
1
,
2
,
3
))
*
1
)
print
[
1
]
+
MyList
([
3
])
class
ListWithInit
(
list
):
class
ListWithInit
(
list
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
print
"ListWithInit.__init__"
,
args
,
kwargs
print
"ListWithInit.__init__"
,
args
,
kwargs
...
...
test/tests/none__class__.py
View file @
e03daee3
print
None
.
__class__
print
None
.
__class__
print
type
(
None
).
__doc__
,
None
.
__doc__
test/tests/str_adding.py
View file @
e03daee3
...
@@ -18,3 +18,7 @@ try:
...
@@ -18,3 +18,7 @@ try:
except
TypeError
as
e
:
except
TypeError
as
e
:
print
e
print
e
print
""
+
D
()
print
""
+
D
()
# This also applies to list:
print
[]
+
D
()
test/tests/str_adding_compat.py
View file @
e03daee3
...
@@ -7,3 +7,8 @@ try:
...
@@ -7,3 +7,8 @@ try:
print
""
.
__add__
(
1
)
print
""
.
__add__
(
1
)
except
TypeError
as
e
:
except
TypeError
as
e
:
print
e
print
e
try
:
print
[].
__add__
(
1
)
except
TypeError
as
e
:
print
e
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