From d3f4a1a00a0c40a57a0a6054dd822271d114c557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 15 Feb 2004 21:01:17 +0000 Subject: Patch #893566: Document that tp_dealloc may be called from any thread. --- Doc/api/newtypes.tex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Doc/api/newtypes.tex b/Doc/api/newtypes.tex index 038cce9..5b2e6cf 100644 --- a/Doc/api/newtypes.tex +++ b/Doc/api/newtypes.tex @@ -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}} -- cgit v0.12