mirror of https://github.com/python/cpython
compare types with is not ==
This commit is contained in:
parent
a617e208fc
commit
28e369a8f8
|
@ -3517,12 +3517,12 @@ class Decimal(object):
|
|||
return (self.__class__, (str(self),))
|
||||
|
||||
def __copy__(self):
|
||||
if type(self) == Decimal:
|
||||
if type(self) is Decimal:
|
||||
return self # I'm immutable; therefore I am my own clone
|
||||
return self.__class__(str(self))
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
if type(self) == Decimal:
|
||||
if type(self) is Decimal:
|
||||
return self # My components are also immutable
|
||||
return self.__class__(str(self))
|
||||
|
||||
|
|
Loading…
Reference in New Issue