]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-93820: Fix copy() regression in enum.Flag (GH-93876) (#93886)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 17 Jun 2022 03:56:20 +0000 (20:56 -0700)
committerGitHub <noreply@github.com>
Fri, 17 Jun 2022 03:56:20 +0000 (06:56 +0300)
commit3fbf5c6427c260eab41c37f6eb7f66b79ab4ea88
tree19afb4bcfe12aef6fb39c52496479d87772a3c0e
parent74561095d906c2ca8ca8f41f22cb23a9e5b58954
gh-93820: Fix copy() regression in enum.Flag (GH-93876) (#93886)

GH-26658 introduced a regression in copy / pickle protocol for combined
`enum.Flag`s. `copy.copy(re.A | re.I)` would fail with
`AttributeError: ASCII|IGNORECASE`.

`enum.Flag` now has a `__reduce_ex__()` method that reduces flags by
combined value, not by combined name.
(cherry picked from commit 05b32c1c796d6c80479756ae898f488eac5f4f71)

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Christian Heimes <christian@python.org>
Lib/enum.py
Lib/test/test_enum.py
Misc/NEWS.d/next/Library/2022-06-15-21-20-02.gh-issue-93820.FAMLY8.rst [new file with mode: 0644]