Persistent broken objects are used for broken objects that are also persistent. In addition to having to track the original object data, they need to handle persistent meta data.
Persistent broken classes are created from existing broken classes using the persistentBroken, function:
>>> Atall = type('Atall', (Broken, ), {'__module__': 'not.there'}) >>> PAtall = persistentBroken(Atall)
(Note that we always get the same persistent broken class for a given broken class:
>>> persistentBroken(Atall) is PAtall True )
Persistent broken classes work a lot like broken classes:
>>> a = PAtall.__new__(PAtall, 1, 2) >>> a <persistent broken not.there.Atall instance None> >>> a.__Broken_newargs__ (1, 2) >>> a.__Broken_initargs__ >>> a.x = 1 Traceback (most recent call last): ... BrokenModified: Can't change broken objects
Unlike regular broken objects, persistent broken objects keep track of persistence meta data:
>>> a._p_oid = \0\0\0\0****
>>> a
>>> a.__reduce__() # doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
...
BrokenModified:
>>> a.__setstate__({'y': 2}) >>> a.__getstate__() {'y': 2}
Cleanup:
>>> broken_cache.clear()
There are no attributes in this class.
There are no methods in this class.
There are no known subclasses.