[Python-checkins] bpo-33652: Remove __getstate__ and __setstate__ methods in typing. (GH-7144)

Ivan Levkivskyi webhook-mailer at python.org
Mon May 28 06:54:59 EDT 2018


https://github.com/python/cpython/commit/97b523db7c79c18c48516fba9410014d9896abc4
commit: 97b523db7c79c18c48516fba9410014d9896abc4
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: Ivan Levkivskyi <levkivskyi at gmail.com>
date: 2018-05-28T11:54:56+01:00
summary:

bpo-33652: Remove __getstate__ and __setstate__ methods in typing. (GH-7144)

files:
M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index e9265afce491..a95eb2e184a0 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -294,13 +294,6 @@ class _SpecialForm(_Final, _Immutable, _root=True):
 
     __slots__ = ('_name', '_doc')
 
-    def __getstate__(self):
-        return {'name': self._name, 'doc': self._doc}
-
-    def __setstate__(self, state):
-        self._name = state['name']
-        self._doc = state['doc']
-
     def __new__(cls, *args, **kwds):
         """Constructor.
 
@@ -555,20 +548,6 @@ def __init__(self, name, *constraints, bound=None,
         if def_mod != 'typing':
             self.__module__ = def_mod
 
-    def __getstate__(self):
-        return {'name': self.__name__,
-                'bound': self.__bound__,
-                'constraints': self.__constraints__,
-                'co': self.__covariant__,
-                'contra': self.__contravariant__}
-
-    def __setstate__(self, state):
-        self.__name__ = state['name']
-        self.__bound__ = state['bound']
-        self.__constraints__ = state['constraints']
-        self.__covariant__ = state['co']
-        self.__contravariant__ = state['contra']
-
     def __repr__(self):
         if self.__covariant__:
             prefix = '+'



More information about the Python-checkins mailing list