Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

disable_gc-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file disable_gc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: disable_gc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for disable_gc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f504e712751b0f2054ac5c638ea090c8190ec1858e877c691dc4554970fd3b64
MD5 e855f803a9b09e9aef6d7e7fb4e480df
BLAKE2b-256 3a80ab63ea1acd544f0ffb74b64cf850655ce5847093f323a55b3d7ed3f08688

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page