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 Dennis Sweeney
Recipients Dennis Sweeney, YoSTEALTH, bar.harel, eric.snow, gregory.p.smith, josh.r, lisroach, ncoghlan, ned.deily, pablogsal, pitrou, pmpp, rhettinger, serhiy.storchaka, yselivanov
Date 2021-01-18.18:18:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610993928.2.0.384537118349.issue31356@roundup.psfhosted.org>
In-reply-to
Content
https://bugs.python.org/issue41545 is a duplicate of this.

In that report, there's an example of something that can go wrong with the save-a-boolean-per-context-manager approach even when threads are not used, but when concurrent generators are used, like

def gen():
    with gc_disabled():
        yield 1
        yield 2
        yield 3

a = gen()
b = gen()
next(a) # disable gc
next(b) 
list(a) # this re-enableds the gc
next(b) # gc is enabled but shouldn't be.

A counter for "number of times disabled" may be a better approach.
History
Date User Action Args
2021-01-18 18:18:48Dennis Sweeneysetrecipients: + Dennis Sweeney, rhettinger, gregory.p.smith, ncoghlan, pitrou, ned.deily, pmpp, eric.snow, serhiy.storchaka, yselivanov, josh.r, YoSTEALTH, bar.harel, lisroach, pablogsal
2021-01-18 18:18:48Dennis Sweeneysetmessageid: <1610993928.2.0.384537118349.issue31356@roundup.psfhosted.org>
2021-01-18 18:18:48Dennis Sweeneylinkissue31356 messages
2021-01-18 18:18:48Dennis Sweeneycreate