diff options
author | Łukasz Langa <lukasz@langa.pl> | 2012-03-12 18:59:48 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2012-03-12 18:59:48 (GMT) |
commit | 17591c1a1d0a6ba20f3b68e2c438d9b9baabc6c9 (patch) | |
tree | 3b8f439bfc86f65cc4c79558a1d980c013f05c3a /Lib | |
parent | f28fcff17d9f777eab52126a9c8a984cac17a9ec (diff) | |
parent | f3078fbee2b6555f0f5b1819a231f4b7d8bdf6b5 (diff) | |
download | cpython-17591c1a1d0a6ba20f3b68e2c438d9b9baabc6c9.zip cpython-17591c1a1d0a6ba20f3b68e2c438d9b9baabc6c9.tar.gz cpython-17591c1a1d0a6ba20f3b68e2c438d9b9baabc6c9.tar.bz2 |
Head merge.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pickle.py | 8 | ||||
-rw-r--r-- | Lib/test/pickletester.py | 12 |
2 files changed, 20 insertions, 0 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): |