bpo-45209: fix `UserWarning: resource_tracker` in test_multiprocessing (GH-28377)

This commit is contained in:
Nikita Sobolev 2021-09-21 20:49:42 +03:00 committed by GitHub
parent 1c7e98dc25
commit f604cf1c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -4178,6 +4178,13 @@ class _TestSharedMemory(BaseTestCase):
" a process was abruptly terminated.")
if os.name == 'posix':
# Without this line it was raising warnings like:
# UserWarning: resource_tracker:
# There appear to be 1 leaked shared_memory
# objects to clean up at shutdown
# See: https://bugs.python.org/issue45209
resource_tracker.unregister(f"/{name}", "shared_memory")
# A warning was emitted by the subprocess' own
# resource_tracker (on Windows, shared memory segments
# are released automatically by the OS).

View File

@ -0,0 +1,2 @@
Fix ``UserWarning: resource_tracker`` warning in
``_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination``