Issue 28076: Variable annotations should be mangled for private names (original) (raw)

Issue28076

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/72263

classification

Title: Variable annotations should be mangled for private names
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.6

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, levkivskyi, python-dev
Priority: normal Keywords: patch

Created on 2016-09-11 10:50 by levkivskyi, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mangle-ann.diff levkivskyi,2016-09-11 10:50 review
Messages (3)
msg275772 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-09-11 10:50
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
msg275807 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-11 16:45
New changeset 1c2a4f29e1ab by Guido van Rossum in branch 'default': Issue #28076: Variable annotations should be mangled for private names. https://hg.python.org/cpython/rev/1c2a4f29e1ab
msg275808 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-09-11 16:46
Thanks! I think you have a PEP update already waiting for me?
History
Date User Action Args
2022-04-11 14:58:36 admin set github: 72263
2016-09-11 16:46:00 gvanrossum set status: open -> closedresolution: fixedmessages: +
2016-09-11 16:45:34 python-dev set nosy: + python-devmessages: +
2016-09-11 10:50:58 levkivskyi create

Supported by The Python Software Foundation,
Powered by Roundup

Copyright © 1990-2022, Python Software Foundation
Legal Statements