mirror of
https://github.com/python/cpython.git
synced 2025-09-20 15:40:32 +00:00
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
This commit is contained in:
parent
1956d5c15f
commit
a7ec0726e2
1 changed files with 9 additions and 0 deletions
|
@ -458,6 +458,15 @@ Pickling and unpickling normal class instances
|
||||||
For :term:`new-style class`\es, if :meth:`__getstate__` returns a false
|
For :term:`new-style class`\es, if :meth:`__getstate__` returns a false
|
||||||
value, the :meth:`__setstate__` method will not be called.
|
value, the :meth:`__setstate__` method will not be called.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
At unpickling time, some methods like :meth:`__getattr__`,
|
||||||
|
:meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
|
||||||
|
instance. In case those methods rely on some internal invariant being
|
||||||
|
true, the type should implement either :meth:`__getinitargs__` or
|
||||||
|
:meth:`__getnewargs__` to establish such an invariant; otherwise, neither
|
||||||
|
:meth:`__new__` nor :meth:`__init__` will be called.
|
||||||
|
|
||||||
|
|
||||||
Pickling and unpickling extension types
|
Pickling and unpickling extension types
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue