This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-06-14.21:53:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623707613.91.0.281785888592.issue44422@roundup.psfhosted.org>
In-reply-to
Content
There are different ways to fix this issue:

* (A) Rewrite threading.enumerate() in C with code which cannot trigger a GC collection
* (B) Disable temporarily the GC
* (C) Use a reentrant lock (PR 26727)

(A) The problem is that functions other than threading.enumerate() 
also rely on this lock, like threading.active_count(). I would prefer to not have to rewrite "half" of threading.py in C. Using a RLock is less intrusive.

(B) This is a simple and reliable option. But gc.disable() is process-wide: it affects all Python threads, and so it might have surprising side effects. Some code might rely on the current exact GC behavior. I would prefer to not disable the GC temporarily.
History
Date User Action Args
2021-06-14 21:53:33vstinnersetrecipients: + vstinner
2021-06-14 21:53:33vstinnersetmessageid: <1623707613.91.0.281785888592.issue44422@roundup.psfhosted.org>
2021-06-14 21:53:33vstinnerlinkissue44422 messages
2021-06-14 21:53:33vstinnercreate