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
4d36e4c5
Commit
4d36e4c5
authored
Mar 12, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namedtuple hack
parent
74ac1a3c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
from_cpython/Lib/collections.py
from_cpython/Lib/collections.py
+31
-0
test/tests/urlparse_test.py
test/tests/urlparse_test.py
+5
-0
No files found.
from_cpython/Lib/collections.py
View file @
4d36e4c5
...
@@ -407,6 +407,37 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
...
@@ -407,6 +407,37 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
return
result
return
result
# Pyston change: use this hacky / slow? version of namedtuple while we work
# on exec support
def
namedtuple
(
name
,
fields
):
if
isinstance
(
fields
,
str
):
fields
=
fields
.
split
()
assert
isinstance
(
fields
,
list
)
for
f
in
fields
:
assert
isinstance
(
f
,
str
)
class
NamedTuple
(
object
):
def
__init__
(
self
,
*
args
):
assert
len
(
args
)
==
len
(
fields
)
for
i
in
xrange
(
len
(
fields
)):
setattr
(
self
,
fields
[
i
],
args
[
i
])
def
__getitem__
(
self
,
idx
):
assert
0
<=
idx
<
len
(
fields
)
return
getattr
(
self
,
fields
[
idx
])
def
__repr__
(
self
):
s
=
name
+
"("
first
=
True
for
f
in
fields
:
if
not
first
:
s
+=
", "
first
=
False
s
+=
"%s=%r"
%
(
f
,
getattr
(
self
,
f
))
s
+=
")"
return
s
return
NamedTuple
########################################################################
########################################################################
### Counter
### Counter
...
...
test/tests/urlparse_test.py
0 → 100644
View file @
4d36e4c5
# skip-if: True
# - this is blocking on some rewriter stuff
import
urlparse
print
urlparse
.
urlparse
(
"http://www.dropbox.com"
)
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