summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 6054c39..bce0516 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2106,6 +2106,18 @@ class Parameter:
self._partial_kwarg = _partial_kwarg
+ def __reduce__(self):
+ return (type(self),
+ (self._name, self._kind),
+ {'_partial_kwarg': self._partial_kwarg,
+ '_default': self._default,
+ '_annotation': self._annotation})
+
+ def __setstate__(self, state):
+ self._partial_kwarg = state['_partial_kwarg']
+ self._default = state['_default']
+ self._annotation = state['_annotation']
+
@property
def name(self):
return self._name
@@ -2658,6 +2670,14 @@ class Signature:
'''
return args[0]._bind(args[1:], kwargs, partial=True)
+ def __reduce__(self):
+ return (type(self),
+ (tuple(self._parameters.values()),),
+ {'_return_annotation': self._return_annotation})
+
+ def __setstate__(self, state):
+ self._return_annotation = state['_return_annotation']
+
def __str__(self):
result = []
render_pos_only_separator = False