]> granicus.if.org Git - python/commit
Pickler.save(): Fix for SF bug #494904: Cannot pickle a class with a
authorGuido van Rossum <guido@python.org>
Wed, 19 Dec 2001 16:55:02 +0000 (16:55 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 19 Dec 2001 16:55:02 +0000 (16:55 +0000)
commitf048a8f6d79173cc1da1bf12c60ae06fea36762c
tree8010b1cdebbe8d725d689509be7a3082285c0dd9
parent5935ff07beb0ed2b37dc7a85f04861122eaa5a9a
Pickler.save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.

Objects that are instances of custom metaclasses, i.e. whose class is
a subclass of 'type', should be pickled the same as new-style classes
(objects whose class is 'type').  This can't be done through a
dispatch table entry, and the __reduce__ trick doesn't work for these,
since it finds the unbound __reduce__ for instances of the class
(inherited from 'object').  So check explicitly using issubclass().
Lib/pickle.py