Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
ce654f48
Commit
ce654f48
authored
May 12, 2013
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15535: Fix pickling of named tuples.
parent
a6df938f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
0 deletions
+8
-0
Lib/collections.py
Lib/collections.py
+4
-0
Lib/test/test_collections.py
Lib/test/test_collections.py
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/collections.py
View file @
ce654f48
...
...
@@ -281,6 +281,10 @@ class {typename}(tuple):
'Return self as a plain tuple. Used by copy and pickle.'
return tuple(self)
def __getstate__(self):
'Exclude the OrderedDict from pickling'
return None
{field_defs}
'''
...
...
Lib/test/test_collections.py
View file @
ce654f48
...
...
@@ -272,6 +272,7 @@ class TestNamedTuple(unittest.TestCase):
q
=
loads
(
dumps
(
p
,
protocol
))
self
.
assertEqual
(
p
,
q
)
self
.
assertEqual
(
p
.
_fields
,
q
.
_fields
)
self
.
assertNotIn
(
b'OrderedDict'
,
dumps
(
p
,
protocol
))
def
test_copy
(
self
):
p
=
TestNT
(
x
=
10
,
y
=
20
,
z
=
30
)
...
...
Misc/NEWS
View file @
ce654f48
...
...
@@ -16,6 +16,9 @@ Library
- Issue #17666: Fix reading gzip files with an extra field.
- Issue #15535: Fix namedtuple pickles which were picking up the OrderedDict
instead of just the underlying tuple.
What's New in Python 3.2.4?
===========================
...
...
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