New submission from Joe Jevnik: I was writing an extension module that was working with weakrefs and wanted to ensure that the GC would not run for a block of code. I noticed that gc.enable/gc.disable are not exposed to C and the state of the gc is in a static variable so it cannot be mutated from an extension.
This change adds an easier way to access this functionality in the C api without going through an import or PyObject_Call. I am wondering where to document these functions as well as PyGC_Collect. I didn't see that function anywhere in the docs (and didn't know about it) so I would like to make them more visible. My first thought was Doc/c-api/gcsupport.rst but this is not in service of supporting the GC, it is about the state of the GC itself. If that seems like a decent place I could add a small section at the bottom about interacting with the GC and document these new functions and PyGC_Collect. I'm sorry if this is exposed elsewhere. If it is I can try to add some links to i ---------- components: Extension Modules files: gc-capi.patch keywords: patch messages: 277245 nosy: llllllllll priority: normal severity: normal status: open title: Add C API for gc.enable, gc.disable, and gc.isenabled versions: Python 3.7 Added file: http://bugs.python.org/file44787/gc-capi.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28254> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com