[Python-Dev] Reference cycle on the module dict (globals())
Victor Stinner
victor.stinner at gmail.com
Tue Jan 19 07:54:17 EST 2016
More information about the Python-Dev mailing list
Tue Jan 19 07:54:17 EST 2016
- Previous message (by thread): [Python-Dev] Reference cycle on the module dict (globals())
- Next message (by thread): [Python-Dev] Code formatter bot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, 2016-01-19 11:39 GMT+01:00 Petr Viktorin <encukou at gmail.com>: >> Did I miss something obvious, or is it a known issue of the garbage >> collector on modules? > > The default type flags are for objects that don't store references. > Since you're creating a mutable container, you need to set > Py_TPFLAGS_HAVE_GC. See https://docs.python.org/3/c-api/gcsupport.html > for all the details. Ok, so I missed this important flag :-) Thanks! I had to fight against the C API to fix all my bugs, but now it works well: a guard keeps a strong reference to the global namespace, but objects are still destroyed when the module is unloaded! FYI I updated my PEP 510 patch to track guards with the garbage collector, and my fat project to fix bugs related to GC: - https://bugs.python.org/issue26098 - https://github.com/haypo/fat Victor
- Previous message (by thread): [Python-Dev] Reference cycle on the module dict (globals())
- Next message (by thread): [Python-Dev] Code formatter bot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list