classification
Title: Improve error message in enum for member name surrounded by underscore.
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: Rubén Jesús García Hernández, docs@python, ethan.furman, miss-islington, xtreak
Priority: normal Keywords: patch

Created on 2019-12-04 09:06 by Rubén Jesús García Hernández, last changed 2020-09-13 20:36 by ethan.furman. This issue is now closed.

Files
File name Uploaded Description Edit
enum.diff.txt Rubén Jesús García Hernández, 2019-12-04 09:06 Patch for enum.py
Pull Requests
URL Status Linked Edit
PR 18370 merged ZackerySpytz, 2020-02-06 06:55
Messages (5)
msg357782 - (view) Author: Rubén Jesús García Hernández (Rubén Jesús García Hernández) * Date: 2019-12-04 09:06
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.
msg357783 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-12-04 09:17
Error message changes in code are normally not backported to older versions so I have changed the subject accordingly and tagged 3.9. Thanks.
msg359059 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2019-12-30 20:56
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.
msg376845 - (view) Author: miss-islington (miss-islington) Date: 2020-09-13 20:27
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/2ec67526a6ed3312f4fac22b527ca0ff161531b8
msg376846 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-09-13 20:36
Thank you, Rubén, for the patch.

Thank you, Karthikeyan, for not making me backport it.  :-)
History
Date User Action Args
2020-09-13 20:36:47ethan.furmansetstatus: open -> closed
versions: + Python 3.10, - Python 3.9
messages: + msg376846

resolution: fixed
stage: patch review -> resolved
2020-09-13 20:27:58miss-islingtonsetnosy: + miss-islington
messages: + msg376845
2020-02-06 06:55:54ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17746
2019-12-30 20:56:25ethan.furmansetassignee: ethan.furman
messages: + msg359059
2019-12-30 10:44:15xtreaksetnosy: + ethan.furman
2019-12-04 09:17:16xtreaksetassignee: docs@python -> (no value)

components: + Library (Lib), - Documentation
title: Improve error message in enum.py for python 3.5 -> Improve error message in enum for member name surrounded by underscore.
nosy: + xtreak
versions: + Python 3.9, - Python 3.5
messages: + msg357783
2019-12-04 09:07:05Rubén Jesús García Hernándezsettype: enhancement
2019-12-04 09:06:38Rubén Jesús García Hernándezcreate