MCPcopy Index your code
hub / github.com/python/cpython / __getstate__

Method __getstate__

Lib/test/test_descr.py:5788–5796  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5786 "A class with __getstate__ and __setstate__ implemented."
5787 __slots__ = ['a']
5788 def __getstate__(self):
5789 state = getattr(self, '__dict__', {}).copy()
5790 for cls in type(self).__mro__:
5791 for slot in cls.__dict__.get('__slots__', ()):
5792 try:
5793 state[slot] = getattr(self, slot)
5794 except AttributeError:
5795 pass
5796 return state
5797 def __setstate__(self, state):
5798 for k, v in state.items():
5799 setattr(self, k, v)

Callers 1

__repr__Method · 0.95

Calls 2

copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected