This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mathematician
Recipients
Date 2001-12-19.04:52:18
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
when pickle retrieves the __reduce__ method of a new 
style class that has a metaclass, instead of 
returning the metaclass's __reduce__ method bound to 
the class, it returns an unbound __reduce__ method of 
that class.

>>> class metaclass(type):
... 	def __reduce__(self):
... 		"""This is metaclass.__reduce__
... 		"""
... 		return type.__reduce__(self)
... 
>>> class newclass(object):
... 	__metaclass__ = metaclass
... 	def __reduce__(self):
... 		"""This is newclass.__reduce__
... 		"""
... 		return object.__reduce__(self)
... 
>>> print newclass.__reduce__.__doc__
This is newclass.__reduce__

when pickle calls object.__reduce__ on newclass, it 
returns an unbound newclass.__reduce__ and not a 
bound metaclass.__reduce__. This has the unfortunate 
side effect of not correctly 'reducing' the class. 
I'm trying to figure out a solution. 

History
Date User Action Args
2007-08-23 13:58:10adminlinkissue494904 messages
2007-08-23 13:58:10admincreate