diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-07-12 22:47:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 22:47:53 (GMT) |
commit | 77d9fdf23be4b705b65b08ed00bb5df7988ecf3c (patch) | |
tree | cea18bd9a44f2933c44bc795b4ba64eb4f5e9ed7 /Lib/enum.py | |
parent | ec7b05a0bebb2cc2ec42bf00cde2b66145880459 (diff) | |
download | cpython-77d9fdf23be4b705b65b08ed00bb5df7988ecf3c.zip cpython-77d9fdf23be4b705b65b08ed00bb5df7988ecf3c.tar.gz cpython-77d9fdf23be4b705b65b08ed00bb5df7988ecf3c.tar.bz2 |
[3.12] gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106695)
gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666)
(cherry picked from commit 357e9e9da3929cb9d55ea31896e66f488e44e8f2)
Co-authored-by: Prince Roshan <princekrroshan01@gmail.com>
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 56ebfbd..9114c5c 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -1242,6 +1242,12 @@ class Enum(metaclass=EnumType): def __reduce_ex__(self, proto): return self.__class__, (self._value_, ) + def __deepcopy__(self,memo): + return self + + def __copy__(self): + return self + # enum.property is used to provide access to the `name` and # `value` attributes of enum members while keeping some measure of # protection from modification, while still allowing for an enumeration |