summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/_test_multiprocessing.py7
-rw-r--r--Misc/NEWS.d/next/Tests/2021-09-15-23-32-39.bpo-45209.55ntL5.rst2
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 8ebcd0d..125e890 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -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).
diff --git a/Misc/NEWS.d/next/Tests/2021-09-15-23-32-39.bpo-45209.55ntL5.rst b/Misc/NEWS.d/next/Tests/2021-09-15-23-32-39.bpo-45209.55ntL5.rst
new file mode 100644
index 0000000..4c3bed0
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-09-15-23-32-39.bpo-45209.55ntL5.rst
@@ -0,0 +1,2 @@
+Fix ``UserWarning: resource_tracker`` warning in
+``_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination``