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
bf1a4973
Commit
bf1a4973
authored
May 05, 2015
by
Chris Toshok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the remaining subclass checks for list comparisons <, <=, >, >=
parent
27e24f67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
src/runtime/list.cpp
src/runtime/list.cpp
+4
-4
test/tests/list_subclassing.py
test/tests/list_subclassing.py
+23
-2
No files found.
src/runtime/list.cpp
View file @
bf1a4973
...
...
@@ -961,7 +961,7 @@ Box* listNe(BoxedList* self, Box* rhs) {
}
Box
*
listLt
(
BoxedList
*
self
,
Box
*
rhs
)
{
if
(
rhs
->
cls
!=
list_cls
)
{
if
(
!
isSubclass
(
rhs
->
cls
,
list_cls
)
)
{
return
NotImplemented
;
}
...
...
@@ -971,7 +971,7 @@ Box* listLt(BoxedList* self, Box* rhs) {
}
Box
*
listLe
(
BoxedList
*
self
,
Box
*
rhs
)
{
if
(
rhs
->
cls
!=
list_cls
)
{
if
(
!
isSubclass
(
rhs
->
cls
,
list_cls
)
)
{
return
NotImplemented
;
}
...
...
@@ -981,7 +981,7 @@ Box* listLe(BoxedList* self, Box* rhs) {
}
Box
*
listGt
(
BoxedList
*
self
,
Box
*
rhs
)
{
if
(
rhs
->
cls
!=
list_cls
)
{
if
(
!
isSubclass
(
rhs
->
cls
,
list_cls
)
)
{
return
NotImplemented
;
}
...
...
@@ -991,7 +991,7 @@ Box* listGt(BoxedList* self, Box* rhs) {
}
Box
*
listGe
(
BoxedList
*
self
,
Box
*
rhs
)
{
if
(
rhs
->
cls
!=
list_cls
)
{
if
(
!
isSubclass
(
rhs
->
cls
,
list_cls
)
)
{
return
NotImplemented
;
}
...
...
test/tests/list_subclassing.py
View file @
bf1a4973
...
...
@@ -13,5 +13,26 @@ print len(MyList.__new__(MyList))
l
[:]
=
l
[:]
print
l
print
[
1
,
2
,
3
]
==
MyList
((
1
,
2
,
3
))
print
[
1
,
2
,
3
]
!=
MyList
((
1
,
2
,
3
))
print
[
1
,
2
,
3
]
==
MyList
((
1
,
2
,
3
,
4
))
print
[
1
,
2
,
3
]
!=
MyList
((
1
,
2
,
3
,
4
))
print
[
1
,
2
,
3
,
4
]
>
MyList
((
1
,
2
,
3
))
print
[
1
,
2
,
3
,
4
]
<
MyList
((
1
,
2
,
3
))
print
[
1
,
2
,
3
]
>
MyList
((
1
,
2
,
3
,
4
))
print
[
1
,
2
,
3
]
<
MyList
((
1
,
2
,
3
,
4
))
print
[
1
,
2
,
3
]
>=
MyList
((
1
,
2
,
3
))
print
[
1
,
2
,
3
]
<=
MyList
((
1
,
2
,
3
))
print
MyList
((
1
,
2
,
3
))
==
MyList
((
1
,
2
,
3
,
4
))
print
MyList
((
1
,
2
,
3
))
!=
MyList
((
1
,
2
,
3
,
4
))
print
MyList
((
1
,
2
,
3
,
4
))
>
MyList
((
1
,
2
,
3
))
print
MyList
((
1
,
2
,
3
,
4
))
<
MyList
((
1
,
2
,
3
))
print
MyList
((
1
,
2
,
3
))
>
MyList
((
1
,
2
,
3
,
4
))
print
MyList
((
1
,
2
,
3
))
<
MyList
((
1
,
2
,
3
,
4
))
print
MyList
((
1
,
2
,
3
))
>=
MyList
((
1
,
2
,
3
))
print
MyList
((
1
,
2
,
3
))
<=
MyList
((
1
,
2
,
3
))
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