New submission from Antony Lee <anntzer....@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33007>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to