Skip to content

Commit 65268ab

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

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4147,6 +4147,13 @@ def test_shared_memory_cleaned_after_process_termination(self):
41474147
" a process was abruptly terminated.")
41484148

41494149
if os.name == 'posix':
4150+
# Without this line it was raising warnings like:
4151+
# UserWarning: resource_tracker:
4152+
# There appear to be 1 leaked shared_memory
4153+
# objects to clean up at shutdown
4154+
# See: https://bugs.python.org/issue45209
4155+
resource_tracker.unregister(f"/{name}", "shared_memory")
4156+
41504157
# A warning was emitted by the subprocess' own
41514158
# resource_tracker (on Windows, shared memory segments
41524159
# are released automatically by the OS).
Lines changed: 2 additions & 0 deletions
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)