summaryrefslogtreecommitdiffstats
path: root/Doc/library/gc.rst
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-02-02 14:31:06 (GMT)
committerGitHub <noreply@github.com>2018-02-02 14:31:06 (GMT)
commit383b32fe108ea627699cc9c644fba5f8bae95d73 (patch)
treeca66e7a85e8cb517f3e2b8751cf0dcf92d4a4cfd /Doc/library/gc.rst
parentaa0735f597b072c0eb00404c4d7df359ddc26755 (diff)
downloadcpython-383b32fe108ea627699cc9c644fba5f8bae95d73.zip
cpython-383b32fe108ea627699cc9c644fba5f8bae95d73.tar.gz
cpython-383b32fe108ea627699cc9c644fba5f8bae95d73.tar.bz2
Revert "bpo-31356: Add context manager to temporarily disable GC GH-5495
This reverts commit 72a0d218dcc94a3cc409a9ef32dfcd5a7bbcb43c. The reverted commit had a few issues so it was unanimously decided to undo it. See the bpo issue for details.
Diffstat (limited to 'Doc/library/gc.rst')
-rw-r--r--Doc/library/gc.rst28
1 files changed, 0 insertions, 28 deletions
diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst
index 92240c7..153d8fb 100644
--- a/Doc/library/gc.rst
+++ b/Doc/library/gc.rst
@@ -33,34 +33,6 @@ The :mod:`gc` module provides the following functions:
Disable automatic garbage collection.
-.. class:: ensure_disabled()
-
- Return a context manager object that disables the garbage collector and reenables the previous
- state upon completion of the block. This is basically equivalent to::
-
- from gc import enable, disable, isenabled
-
- @contextmanager
- def ensure_disabled():
- was_enabled_previously = isenabled()
- gc.disable()
- yield
- if was_enabled_previously:
- gc.enable()
-
- And lets you write code like this::
-
- with ensure_disabled():
- run_some_timing()
-
- with ensure_disabled():
- # do_something_that_has_real_time_guarantees
- # such as a pair trade, robotic braking, etc
-
- without needing to explicitly enable and disable the garbage collector yourself.
- This context manager is implemented in C to assure atomicity, thread safety and speed.
-
-
.. function:: isenabled()
Returns true if automatic collection is enabled.