New submission from Ivan Levkivskyi:
Variable annotations for private names are stored in __annotations__ without
name mangling. This is inconsistent with how function annotations behave:
class C:
def meth(__x: int): ...
assert C.meth.__annotations__ == {'_C__x': int}
The attached patch fixes variable annotations to behave in the same way:
class C:
__foo: int = 1
assert C.__dict__['_C_foo'] == 1
assert C.__annotations__['_C__foo'] == int
----------
components: Interpreter Core
files: mangle-ann.diff
keywords: patch
messages: 275772
nosy: gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Variable annotations should be mangled for private names
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file44552/mangle-ann.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com