[New-bugs-announce] [issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.
Antony Lee
report at bugs.python.org
Tue Mar 6 00:36:52 EST 2018
New submission from Antony Lee <anntzer.lee at gmail.com>:
Consider the following example:
import pickle
class T:
def __init__(self):
self.attr = self.__foo
def __foo(self):
pass
print(pickle.loads(pickle.dumps(T())))
This fails on 3.6 with `AttributeError: 'T' object has no attribute '__foo'` (i.e. there's a lookup on the unmangled name). As a comparison, replacing `__foo` with `_foo` results in working code.
----------
components: Library (Lib)
messages: 313306
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Objects referencing private-mangled names do not roundtrip properly under pickling.
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33007>
_______________________________________
More information about the New-bugs-announce
mailing list