diff options
author | Prince Roshan <princekrroshan01@gmail.com> | 2023-07-13 02:31:17 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 14:01:17 -0700 |
commit | 357e9e9da3929cb9d55ea31896e66f488e44e8f2 (patch) | |
tree | 6e1d540f81d5d3e3bbd4cc4e4e4b83fcbb4f2d3b /Lib/enum.py | |
parent | e4b88c1e4ac129b36f99a534387d64f7b8cda8ef (diff) | |
download | cpython-357e9e9da3929cb9d55ea31896e66f488e44e8f2.tar.gz cpython-357e9e9da3929cb9d55ea31896e66f488e44e8f2.zip |
gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666)
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 202f0da028b..0c985b2c778 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -1218,6 +1218,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 |