[Python-checkins] cpython: inspect: Add __slots__ to BoundArguments.

yury.selivanov python-checkins at python.org
Wed May 13 23:38:11 CEST 2015


https://hg.python.org/cpython/rev/ee31277386cb
changeset:   96038:ee31277386cb
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Wed May 13 17:18:41 2015 -0400
summary:
  inspect: Add __slots__ to BoundArguments.

files:
  Lib/inspect.py |  9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/Lib/inspect.py b/Lib/inspect.py
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2377,6 +2377,8 @@
         Dict of keyword arguments values.
     """
 
+    __slots__ = ('arguments', '_signature', '__weakref__')
+
     def __init__(self, signature, arguments):
         self.arguments = arguments
         self._signature = signature
@@ -2443,6 +2445,13 @@
                 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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list