Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: 1. The used approach was broken in the presence of multiple threads too. It didn't guarantee even that GC will be disabled in the next line.
2. What is a sense of disabling GC in a single thread? Objects in Python are not thread local, they are accessible from all threads, and collecting garbage in one thread affects other threads. For truly disabling GC globally you need to use a counted semaphore or other synchronization primitives, and this can be implemented at Python level. But what are use cases for this context manager? Isn't naive approach enough? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31356> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com