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
components: Extension Modules
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>
Python-bugs-list mailing list