Patch #893566: Document that tp_dealloc may be called from any thread.

This commit is contained in:
Martin v. Löwis 2004-02-15 21:01:17 +00:00
parent 7db04e7c48
commit d3f4a1a00a
1 changed files with 10 additions and 0 deletions

View File

@ -1389,6 +1389,16 @@ inherited by subtypes.
field.
\end{cmemberdesc}
Also, note that, in a garbage collected Python, tp_dealloc may be
called from any Python thread, not just the thread which created the
object (if the object becomes part of a refcount cycle, that cycle
might be collected by a garbage collection on any thread). This is
not a problem for Python API calls, since the thread on which
tp_dealloc is called will own the Global Interpreter Lock (GIL).
However, if the object being destroyed in turn destroys objects from
some other C or C++ library, care should be taken to ensure that
destroying those objects on the thread which called tp_dealloc will
not violate any assumptions of the library.
\section{Mapping Object Structures \label{mapping-structs}}