[issue38967] Improve error message in enum.py for python 3.5

New submission from Rubén Jesús García Hernández <rubengarciahernandez@gmail.com>: I changed the '_names_ are reserved for future Enum use' line to be more user-friendly thus: 'Names surrounded by underscore (such as "%s") are reserved for future Enum use' % key The current message can be interpreted as the literal string _names_; and showing the offending key can help users debug. ---------- assignee: docs@python components: Documentation files: enum.diff.txt messages: 357782 nosy: Rubén Jesús García Hernández, docs@python priority: normal severity: normal status: open title: Improve error message in enum.py for python 3.5 versions: Python 3.5 Added file: https://bugs.python.org/file48754/enum.diff.txt _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Change by Rubén Jesús García Hernández <rubengarciahernandez@gmail.com>: ---------- type: -> enhancement _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: Error message changes in code are normally not backported to older versions so I have changed the subject accordingly and tagged 3.9. Thanks. ---------- assignee: docs@python -> components: +Library (Lib) -Documentation nosy: +xtreak title: Improve error message in enum.py for python 3.5 -> Improve error message in enum for member name surrounded by underscore. versions: +Python 3.9 -Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- nosy: +ethan.furman _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Ethan Furman <ethan@stoneleaf.us> added the comment: Rubén, good idea. I wonder, though, if we should say: _sunder_ names, such as "%s", are reserved for future Enum use since `_sunder_` is used in the Enum docs and is unlikely to be confused with one's own variable name. ---------- assignee: -> ethan.furman _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Change by Zackery Spytz <zspytz@gmail.com>: ---------- keywords: +patch pull_requests: +17746 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18370 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 2ec67526a6ed3312f4fac22b527ca0ff161531b8 by Zackery Spytz in branch 'master': bpo-38967: Improve the error msg for reserved _sunder_ names in enum (GH-18370) https://github.com/python/cpython/commit/2ec67526a6ed3312f4fac22b527ca0ff161... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________

Ethan Furman <ethan@stoneleaf.us> added the comment: Thank you, Rubén, for the patch. Thank you, Karthikeyan, for not making me backport it. :-) ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 -Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue38967> _______________________________________
participants (5)
-
Ethan Furman
-
Karthikeyan Singaravelan
-
miss-islington
-
Rubén Jesús García Hernández
-
Zackery Spytz