[issue31356] Add context manager to temporarily disable GC

Raymond Hettinger report at bugs.python.org
Tue Sep 5 19:47:24 EDT 2017


New submission from Raymond Hettinger:

Used like this:

    with gc_disabled():
        run_some_timing()

    with gc_disabled():
        # do_something_that_has_real_time_guarantees
        # such as a pair trade, robotic braking, etc

This would be implemented in C for atomicity and speed.  It would be roughly equivalent to:

    @contextmanager
    def gc_disabled():
        if gc.isenabled():
            gc.disable()
            yield
            gc.enable()
        else:
            yield

----------
assignee: ncoghlan
components: Interpreter Core
messages: 301407
nosy: eric.snow, gregory.p.smith, ncoghlan, rhettinger
priority: normal
severity: normal
status: open
title: Add context manager to temporarily disable GC
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31356>
_______________________________________


More information about the Python-bugs-list mailing list