diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-03-12 20:54:03 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-03-12 20:54:03 (GMT) |
commit | c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b (patch) | |
tree | f39f5fef0b05d95375303417369a4f708a139f53 /Lib | |
parent | 5f99ced092b01401d9e1637c493fa61d948101fe (diff) | |
parent | 17591c1a1d0a6ba20f3b68e2c438d9b9baabc6c9 (diff) | |
download | cpython-c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b.zip cpython-c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b.tar.gz cpython-c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b.tar.bz2 |
Merge
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pickle.py | 8 | ||||
-rw-r--r-- | Lib/test/pickletester.py | 12 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index 20b3646..9e65368 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -438,6 +438,14 @@ class _Pickler: self.write(NONE) dispatch[type(None)] = save_none + def save_ellipsis(self, obj): + self.save_global(Ellipsis, 'Ellipsis') + dispatch[type(Ellipsis)] = save_ellipsis + + def save_notimplemented(self, obj): + self.save_global(NotImplemented, 'NotImplemented') + dispatch[type(NotImplemented)] = save_notimplemented + def save_bool(self, obj): if self.proto >= 2: self.write(obj and NEWTRUE or NEWFALSE) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 1a551c8..3686a62 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -743,6 +743,18 @@ class AbstractPickleTests(unittest.TestCase): u = self.loads(s) self.assertEqual(t, u) + def test_ellipsis(self): + for proto in protocols: + s = self.dumps(..., proto) + u = self.loads(s) + self.assertEqual(..., u) + + def test_notimplemented(self): + for proto in protocols: + s = self.dumps(NotImplemented, proto) + u = self.loads(s) + self.assertEqual(NotImplemented, u) + # Tests for protocol 2 def test_proto(self): diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 551c3a5..9f6af7f 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -882,7 +882,7 @@ class SizeofTest(unittest.TestCase): check = self.check_sizeof # _ast.AST import _ast - check(_ast.AST(), size(h + '')) + check(_ast.AST(), size(h + 'P')) # imp.NullImporter import imp check(imp.NullImporter(self.file.name), size(h + '')) |