diff options
author | Guido van Rossum <guido@python.org> | 2016-10-29 19:44:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2016-10-29 19:44:30 (GMT) |
commit | c6c1c6ef79b359ca4f6b30c0c91514e9ea486b9c (patch) | |
tree | c16696f03e3fc4ac031b7febbe89c7e766b5ee6a /Lib/typing.py | |
parent | 4782ab3aa36554efb3f43f4f6ed70f8837801151 (diff) | |
parent | b7dedc89f1ec476352f3678d0c55252159da27df (diff) | |
download | cpython-c6c1c6ef79b359ca4f6b30c0c91514e9ea486b9c.zip cpython-c6c1c6ef79b359ca4f6b30c0c91514e9ea486b9c.tar.gz cpython-c6c1c6ef79b359ca4f6b30c0c91514e9ea486b9c.tar.bz2 |
Issue #28556: updates to typing.py (fix copy, deepcopy, pickle) (3.5->3.6)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index bda4ea5..572708b 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -190,6 +190,9 @@ class _FinalTypingBase(_TypingBase, _root=True): return self raise TypeError("Cannot instantiate %r" % cls) + def __reduce__(self): + return _trim_name(type(self).__name__) + class _ForwardRef(_TypingBase, _root=True): """Wrapper to hold a forward reference.""" @@ -1051,6 +1054,11 @@ class GenericMeta(TypingMeta, abc.ABCMeta): # classes are supposed to be rare anyways. return issubclass(instance.__class__, self) + def __copy__(self): + return self.__class__(self.__name__, self.__bases__, dict(self.__dict__), + self.__parameters__, self.__args__, self.__origin__, + self.__extra__, self.__orig_bases__) + # Prevent checks for Generic to crash when defining Generic. Generic = None |