Fixes #13842: cannot pickle Ellipsis or NotImplemented.

Thanks for James Sanders for the bug report and the patch.
This commit is contained in:
Łukasz Langa 2012-03-12 19:46:12 +01:00
parent e976fc7464
commit f3078fbee2
4 changed files with 42 additions and 0 deletions

View file

@ -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)