Ammar Askar <am...@ammaraskar.com> added the comment:

> I'd expected the GC to be truly enabled only on the second call to 
> `enable()`, but apparently it's enabled on the first call :( Both 
> `gc.enable()` and `gc.disable()` just write `1`/`0` to `gcstate->enabled`, 
> respectively.

I don't think this API makes much sense. I would expect `enable()` to enable 
the GC regardless of how many disable calls have been made. This is also in 
line with other functions like `faulthandler.enable()` / 
`bdb.Breakpoint.enable()`

I think the proper solution if you want to do this would be to wrap the 
disabling/enabling and keep track of the number of calls yourself.

----------
nosy: +ammar2

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41545>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to