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
d2f33c5e
Commit
d2f33c5e
authored
Sep 11, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More set stuff
symmetric_difference, in-place binops, etc
parent
9df41bb5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
176 additions
and
93 deletions
+176
-93
from_cpython/Lib/test/test_setcomps.py
from_cpython/Lib/test/test_setcomps.py
+0
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+5
-1
src/runtime/set.cpp
src/runtime/set.cpp
+138
-70
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+1
-2
test/test_extension/setup.py
test/test_extension/setup.py
+0
-1
test/tests/set.py
test/tests/set.py
+32
-6
test/tests/set_more.py
test/tests/set_more.py
+0
-12
No files found.
from_cpython/Lib/test/test_setcomps.py
View file @
d2f33c5e
# expected: fail
doctests
=
"""
########### Tests mostly copied from test_listcomps.py ############
...
...
src/runtime/objmodel.cpp
View file @
d2f33c5e
...
...
@@ -3463,9 +3463,13 @@ void rearrangeArguments(ParamReceiveSpec paramspec, const ParamNames* param_name
BoxedDict
*
d_kwargs
=
static_cast
<
BoxedDict
*>
(
kwargs
);
BoxedDict
*
okwargs
=
NULL
;
if
(
d_kwargs
->
d
.
size
())
if
(
d_kwargs
->
d
.
size
())
{
okwargs
=
get_okwargs
();
if
(
!
okwargs
&&
(
!
param_names
||
!
param_names
->
takes_param_names
))
raiseExcHelper
(
TypeError
,
"%s() doesn't take keyword arguments"
,
func_name
);
}
for
(
const
auto
&
p
:
*
d_kwargs
)
{
auto
k
=
coerceUnicodeToStr
(
p
.
first
);
...
...
src/runtime/set.cpp
View file @
d2f33c5e
This diff is collapsed.
Click to expand it.
test/CPYTHON_TEST_NOTES.md
View file @
d2f33c5e
...
...
@@ -62,8 +62,7 @@ test_random long("invalid number")
test_repr complex.__hash__; some unknown issues
test_richcmp PyObject_Not
test_scope eval of code object from existing function (not currently supported)
test_set weird function-picking issue
test_setcomps parser not raising a SyntaxError when assigning to a setcomp
test_set lots of set issues
test_sort argument specification issue in listSort?
test_str memory leak?
test_string infinite loops in test_replace
...
...
test/test_extension/setup.py
View file @
d2f33c5e
...
...
@@ -12,7 +12,6 @@ def relpath(fn):
r
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
fn
)
return
r
print
glob
.
glob
(
"../from_cpython/Include/*.h"
)
builtin_headers
=
map
(
relpath
,
glob
.
glob
(
"../../from_cpython/Include/*.h"
))
for
m
in
extensions
:
...
...
test/tests/set.py
View file @
d2f33c5e
...
...
@@ -117,6 +117,22 @@ class MySet(set):
class
MyFrozenset
(
frozenset
):
pass
s
=
s1
=
set
()
s
|=
MySet
(
range
(
2
))
print
sorted
(
s
),
sorted
(
s1
)
s
&=
MySet
(
range
(
1
))
print
sorted
(
s
),
sorted
(
s1
)
s
^=
MySet
(
range
(
4
))
print
sorted
(
s
),
sorted
(
s1
)
s
-=
MySet
(
range
(
3
))
print
sorted
(
s
),
sorted
(
s1
)
try
:
set
()
|
range
(
5
)
assert
0
except
TypeError
as
e
:
print
e
compare_to
=
[]
for
i
in
xrange
(
10
):
compare_to
.
append
(
set
(
range
(
i
)))
...
...
@@ -125,10 +141,11 @@ for i in xrange(10):
compare_to
.
append
(
MyFrozenset
(
range
(
i
)))
compare_to
.
append
(
range
(
i
))
compare_to
.
append
(
range
(
i
,
10
))
compare_to
.
append
([
0
,
0
,
1
,
1
])
for
s1
in
set
(
range
(
5
)),
frozenset
(
range
(
5
)):
for
s2
in
compare_to
:
print
type
(
s2
),
sorted
(
s2
),
s1
.
issubset
(
s2
),
s1
.
issuperset
(
s2
),
sorted
(
s1
.
difference
(
s2
)),
s1
.
isdisjoint
(
s2
),
sorted
(
s1
.
union
(
s2
)),
sorted
(
s1
.
intersection
(
s2
))
print
type
(
s2
),
sorted
(
s2
),
s1
.
issubset
(
s2
),
s1
.
issuperset
(
s2
),
sorted
(
s1
.
difference
(
s2
)),
s1
.
isdisjoint
(
s2
),
sorted
(
s1
.
union
(
s2
)),
sorted
(
s1
.
intersection
(
s2
))
,
sorted
(
s1
.
symmetric_difference
(
s2
))
print
s1
==
s2
,
s1
!=
s2
try
:
print
s1
<
s2
,
s1
<=
s2
,
s1
>
s2
,
s1
>=
s2
...
...
@@ -138,11 +155,14 @@ f = float('nan')
s
=
set
([
f
])
print
f
in
s
,
f
==
list
(
s
)[
0
]
s1
=
set
([
3
,
5
])
s2
=
set
([
1
,
5
])
s1
.
intersection_update
(
s2
)
print
sorted
(
s1
)
for
fn
in
(
set
.
intersection_update
,
set
.
difference_update
,
set
.
symmetric_difference_update
,
set
.
__sub__
,
set
.
__or__
,
set
.
__xor__
,
set
.
__and__
):
s1
=
set
([
3
,
5
])
s2
=
set
([
1
,
5
])
r
=
fn
(
s1
,
s2
)
if
r
:
print
r
,
print
sorted
(
s1
),
sorted
(
s2
)
def
test_set_creation
(
base
):
print
"Testing with base ="
,
base
...
...
@@ -173,3 +193,9 @@ def test_set_creation(base):
print
MySet
(
g
())
test_set_creation
(
set
)
test_set_creation
(
frozenset
)
set
(
**
{})
try
:
set
(
**
dict
(
a
=
1
))
except
TypeError
:
print
"TypeError"
test/tests/set_more.py
deleted
100644 → 0
View file @
9df41bb5
# expected: fail
print
hasattr
(
set
,
"__ior__"
)
print
hasattr
(
set
,
"__isub__"
)
print
hasattr
(
set
,
"__iand__"
)
print
hasattr
(
set
,
"__ixor__"
)
s1
=
set
()
|
set
(
range
(
3
))
s2
=
set
(
range
(
1
,
5
))
s3
=
s1
s1
-=
s2
print
s1
,
s2
,
s3
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