diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 14:40:06 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 14:40:06 (GMT) |
commit | a7ec0726e2783c3ba886707df2a8ddd0e7e909db (patch) | |
tree | defb7ac656d0c6a4c675952c57275806f1ccc970 | |
parent | 1956d5c15f566d900644fc3e685e5b9bd663e2ae (diff) | |
download | cpython-a7ec0726e2783c3ba886707df2a8ddd0e7e909db.zip cpython-a7ec0726e2783c3ba886707df2a8ddd0e7e909db.tar.gz cpython-a7ec0726e2783c3ba886707df2a8ddd0e7e909db.tar.bz2 |
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
-rw-r--r-- | Doc/library/pickle.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index a99dc86..f6b7ae4 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -458,6 +458,15 @@ Pickling and unpickling normal class instances For :term:`new-style class`\es, if :meth:`__getstate__` returns a false 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |