Skip to content

Commit

Permalink
bpo-45209: fix UserWarning: resource_tracker in test_multiprocessing (
Browse files Browse the repository at this point in the history
GH-28377)

(cherry picked from commit f604cf1)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn authored Sep 21, 2021
1 parent d0d83a9 commit 09e5016
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4178,6 +4178,13 @@ def test_shared_memory_cleaned_after_process_termination(self):
" 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).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``UserWarning: resource_tracker`` warning in
``_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination``

0 comments on commit 09e5016

Please sign in to comment.