]> granicus.if.org Git - python/commitdiff
inspect: Add __slots__ to BoundArguments.
authorYury Selivanov <yselivanov@sprymix.com>
Wed, 13 May 2015 21:18:41 +0000 (17:18 -0400)
committerYury Selivanov <yselivanov@sprymix.com>
Wed, 13 May 2015 21:18:41 +0000 (17:18 -0400)
Lib/inspect.py

index e52d86e5cc9cc46a4a4954d0d63c43b2f0ec2f9b..9f4d0055d34d3700a8fa844eeea72875b40872e7 100644 (file)
@@ -2377,6 +2377,8 @@ class BoundArguments:
         Dict of keyword arguments values.
     """
 
+    __slots__ = ('arguments', '_signature', '__weakref__')
+
     def __init__(self, signature, arguments):
         self.arguments = arguments
         self._signature = signature
@@ -2443,6 +2445,13 @@ class BoundArguments:
                 self.signature == other.signature and
                 self.arguments == other.arguments)
 
+    def __setstate__(self, state):
+        self._signature = state['_signature']
+        self.arguments = state['arguments']
+
+    def __getstate__(self):
+        return {'_signature': self._signature, 'arguments': self.arguments}
+
 
 class Signature:
     """A Signature object represents the overall signature of a function.