Metadata-Version: 2.1
Name: disable-gc
Version: 0.1.0
Summary: UNKNOWN
Home-page: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.7

disable\_gc
===========

Python context manager for temporarily disabling the garbage collector.

Reentrant, threadsafe, safe for use in asyncio, and prevents GC
starvation.

Safe for use inside finalizers.

Usage
=====

::

    from disable_gc import disable_gc
    with disable_gc:
        a = 1 # Doing things with GC disabled

    @disable_gc
    def func():
        a = 1  # GC disabled inside the function.

Notes
=====

``disable_gc`` does not and cannot monkey patch ``gc.enable()``. Other
threads enabling the gc in the background will leave it enabled until
``disable_gc`` is reentered once again.

Can be used as a reference for
`bpo-31356 <https://bugs.python.org/issue31356>`__.


