Skip to content

Commit 09e5016

Browse files
bpo-45209: fix UserWarning: resource_tracker in test_multiprocessing (GH-28377)
(cherry picked from commit f604cf1) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent d0d83a9 commit 09e5016

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/test/_test_multiprocessing.py

+7
Original file line numberDiff line numberDiff line change
@@ -4178,6 +4178,13 @@ def test_shared_memory_cleaned_after_process_termination(self):
41784178
" a process was abruptly terminated.")
41794179

41804180
if os.name == 'posix':
4181+
# Without this line it was raising warnings like:
4182+
# UserWarning: resource_tracker:
4183+
# There appear to be 1 leaked shared_memory
4184+
# objects to clean up at shutdown
4185+
# See: https://bugs.python.org/issue45209
4186+
resource_tracker.unregister(f"/{name}", "shared_memory")
4187+
41814188
# A warning was emitted by the subprocess' own
41824189
# resource_tracker (on Windows, shared memory segments
41834190
# are released automatically by the OS).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``UserWarning: resource_tracker`` warning in
2+
``_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination``

0 commit comments

Comments
 (0)