]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-93820: Fix copy() regression in enum.Flag (GH-93876)
authorChristian Heimes <christian@python.org>
Thu, 16 Jun 2022 06:42:36 +0000 (08:42 +0200)
committerGitHub <noreply@github.com>
Thu, 16 Jun 2022 06:42:36 +0000 (23:42 -0700)
commit05b32c1c796d6c80479756ae898f488eac5f4f71
treecfeebd93990074a5729b973806c802e047679b46
parent8ba1c7f72010dedb80f0794c5f1dd1c97f81ec83
gh-93820: Fix copy() regression in enum.Flag (GH-93876)

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.
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]