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
3b1fed05
Commit
3b1fed05
authored
Aug 12, 2014
by
Chris Ramstad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed boxStrConstant, uncommented a few tests
parent
277fee03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+3
-5
test/tests/tuples.py
test/tests/tuples.py
+2
-2
No files found.
src/runtime/tuple.cpp
View file @
3b1fed05
...
...
@@ -227,19 +227,17 @@ extern "C" Box* tupleNew(Box* _cls, BoxedTuple* args, BoxedDict* kwargs) {
elements
=
args
->
elts
[
0
];
}
else
{
assert
(
kwargs_sz
);
static
const
BoxedString
*
seq_str
=
boxStrConstant
(
"sequence"
);
auto
const
seq
=
*
(
kwargs
->
d
.
begin
());
auto
const
kw
=
static_cast
<
BoxedString
*>
(
seq
.
first
);
if
(
kw
->
s
==
seq_str
->
s
)
if
(
kw
->
s
==
"sequence"
)
elements
=
seq
.
second
;
else
raiseExcHelper
(
TypeError
,
"'%s' is an invalid keyword argument for this function"
,
kw
->
s
.
c_str
());
}
llvm
::
iterator_range
<
BoxIterator
>
range
=
elements
->
pyElements
();
for
(
BoxIterator
it1
=
range
.
begin
();
it1
!=
range
.
end
();
++
it1
)
velts
.
push_back
(
*
it1
);
for
(
auto
e
:
elements
->
pyElements
())
velts
.
push_back
(
e
);
}
return
new
BoxedTuple
(
std
::
move
(
velts
));
...
...
test/tests/tuples.py
View file @
3b1fed05
...
...
@@ -89,13 +89,13 @@ print tuple(sequence=(1,3,7,42))
print
tuple
(
sequence
=
[
'i'
,
42
,
'j'
,
318
])
print
tuple
(
sequence
=
'hello world'
)
print
tuple
(
sequence
=
{
'a'
:
1
})
#print tuple(sequence={1,2,3,4}
)
print
sorted
(
tuple
(
sequence
=
{
1
,
2
,
3
,
4
})
)
print
tuple
((
1
,
3
,
7
,
42
))
==
tuple
(
sequence
=
(
1
,
3
,
7
,
42
))
print
tuple
([
'i'
,
42
,
'j'
,
318
])
==
tuple
(
sequence
=
[
'i'
,
42
,
'j'
,
318
])
print
tuple
(
'hello world'
)
==
tuple
(
sequence
=
'hello world'
)
print
tuple
({
'a'
:
1
})
==
tuple
(
sequence
=
{
'a'
:
1
})
#print tuple({1,2,3,4}) == tuple(sequence={1,2,3,4}
)
print
sorted
(
tuple
({
1
,
2
,
3
,
4
}))
==
sorted
(
tuple
(
sequence
=
{
1
,
2
,
3
,
4
})
)
# too many arguments
try
:
...
...
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