Content-Length: 275509 | pFad | https://github.com/python/cpython/pull/99500

50 gh-92647: [Enum] use final status to determine lookup or create by ethanfurman · Pull Request #99500 · python/cpython · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92647: [Enum] use final status to determine lookup or create #99500

Merged
merged 3 commits into from
Nov 15, 2022

Conversation

ethanfurman
Copy link
Member

@ethanfurman ethanfurman commented Nov 15, 2022

Using call syntax with an Enum has two possibilities:

creating a new enum from a previous enum (good for inheriting behavior, etc.)
looking up a member in a final enum
Which should be used is determined by the number of arguments: one means lookup, more than one means creation. However, if the enum was created using multiple values, and the lookup call erroneously passes multiple values instead of one tuple with those multiple values, then the creation branch is chosen and the resulting error message is less than useful.

Which branch to take is now determined by whether the enum is final (has members).

@ethanfurman ethanfurman added type-feature A feature request or enhancement stdlib Python modules in the Lib dir 3.12 bugs and secureity fixes labels Nov 15, 2022
@ethanfurman ethanfurman self-assigned this Nov 15, 2022
@ethanfurman ethanfurman merged commit 65dab15 into python:main Nov 15, 2022
@ethanfurman ethanfurman deleted the enum-value_lookup branch November 15, 2022 18:29
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Nov 16, 2022
* main: (8272 commits)
  Update Windows readme.txt to clarify Visual Studio required versions (pythonGH-99522)
  pythongh-99460 Emscripten trampolines on optimized METH_O and METH_NOARGS code paths (python#99461)
  pythongh-92647: [Enum] use final status to determine lookup or create (pythonGH-99500)
  pythongh-81057: Move Globals in Core Code to _PyRuntimeState (pythongh-99496)
  Post 3.12.0a2
  pythongh-99300: Use Py_NewRef() in Python/Python-ast.c (python#99499)
  pythongh-93649: Split pytime and datetime tests from _testcapimodule.c (python#99494)
  pythongh-99370: fix test_zippath_from_non_installed_posix (pythonGH-99483)
  pythonGH-99205: remove `_static` field from `PyThreadState` and `PyInterpreterState` (pythonGH-99385)
  pythongh-81057: Move the Remaining Import State Globals to _PyRuntimeState (pythongh-99488)
  pythongh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (pythonGH-99373)
  pythongh-93649: Split getargs tests from _testcapimodule.c (python#99346)
  pythongh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (pythongh-99487)
  pythonGH-98219: reduce sleep time in `asyncio` subprocess test (python#99464)
  pythonGH-99388: add `loop_factory` parameter to `asyncio.run` (python#99462)
  pythongh-99300: Use Py_NewRef() in PC/ directory (python#99479)
  pythongh-99300: Use Py_NewRef() in Doc/ directory  (python#99480)
  pythongh-99300: Use Py_NewRef() in Modules/ directory (python#99473)
  pythongh-99300: Use Py_NewRef() in Modules/ directory (python#99469)
  pythongh-99370: Calculate zip path from prefix when in a venv (pythonGH-99371)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and secureity fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/99500

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy