Bugs item #1443328, was opened at 2006-03-05 04:18 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1443328&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Daniele Varrazzo (dvarrazzo) >Assigned to: Tim Peters (tim_one) Summary: Pickle protocol 2 fails on private slots. Initial Comment: The pickling protocol 2 can manage new style objects defining __slots__ and without __dict__. Anyway it fails when one of the slots is "private". >>> class C1(object): __slots__ = ["__priv"] def __init__(self): self.__priv = 42 def get_priv(self): return self.__priv >>> C1().get_priv() 42 >>> import pickle >>> pickle.loads(pickle.dumps(C1(), 2)).get_priv() Traceback (most recent call last): File "<pyshell#258>", line 1, in -toplevel- pickle.loads(pickle.dumps(C1(), 2)).get_priv() File "<pyshell#255>", line 6, in get_priv return self.__priv AttributeError: _C1__priv of course redefining __getstate__ and __setstate__ bypasses the problem. the cPickle module shows the same issue. ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-03-09 08:21 Message: Logged In: YES user_id=849994 Confirmed with pickle and cPickle here. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1443328&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com