SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 2 Python

gh-91577: SharedMemory move imports out of methods (#91579)

SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a __del__() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.__init__() can also use this imported resource_tracker.
S
samtygier committed
9a458befdd68625d088f4fea7df135a57d147deb
Parent: a38c2a6
Committed by GitHub <noreply@github.com> on 6/16/2022, 1:41:51 PM