Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-82300: Add track parameter to shared memory#110778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
28 commits Select commitHold shift + click to select a range
3be08b4 add track parameter to shared memory
pan324f50812a phrasing
pan324cbc8431 📜🤖 Added by blurb_it.
blurb-it[bot]7138447 phrasing
pan3246bbfca6 Merge branch 'main' of https://github.com/python/cpython into shmemun…
pan324db79426 Merge branch 'python:main' into shmemuntrack
pan324db11894 Merge branch 'shmemuntrack' of github.com:pan324/cpython into shmemun…
pan324d44cb82 Delete Doc/library/result.html
pan324c62cff0 Merge branch 'main' into shmemuntrack
ambvdcda10f Update Misc/NEWS.d/next/Library/2023-10-12-18-19-47.gh-issue-82300.P8…
pan32463d21d7 Update Doc/library/multiprocessing.shared_memory.rst
pan324e990e41 Update Doc/library/multiprocessing.shared_memory.rst
pan3249c593ba Removed TypeError. Clarified documentation.
pan3249ef1ff3 untracking shmem can unlink now
pan324e5fe674 Update Doc/library/multiprocessing.shared_memory.rst
pan32466acf90 removed unneeded try-except
pan3243fdf625 phrasing of track parameter
pan324d65e3f8 Update Doc/library/multiprocessing.shared_memory.rst
pan324a97c6d3 untracking test
pan32417c07f5 untrack tests both track=True and track=False
pan32413f3fb6 untrack tests both track=True and track=False
pan3247c7f0e7 untrack tests both track=True and track=False
pan324765afb7 reliable test cleanup
pan324a5848c1 Update Doc/library/multiprocessing.shared_memory.rst
pan3248255e01 split tests
pan3245d89117 split tests
pan32466db5b8 style: add a missing blank line
gpshead52053f8 Merge branch 'main' into shmemuntrack
gpsheadFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
split tests
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit8255e015b61baeaca125e3196580c6c7721b91b6
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4444,8 +4444,7 @@ def test_shared_memory_cleaned_after_process_termination(self): | ||
| def test_shared_memory_untracking(self): | ||
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # gh-82300: When a separate Python process accesses shared memory | ||
| # with track=False, it must not cause the memory to be deleted | ||
| # when terminating. | ||
| cmd = '''if 1: | ||
| import sys | ||
| from multiprocessing.shared_memory import SharedMemory | ||
| @@ -4457,6 +4456,7 @@ def test_shared_memory_untracking(self): | ||
| # err existing means that the tracker process has terminated now. | ||
| try: | ||
| rc, out, err = script_helper.assert_python_ok("-c", cmd, mem.name) | ||
| self.assertNotIn(b"resource_tracker", err) | ||
| self.assertEqual(rc, 0) | ||
| mem2 = shared_memory.SharedMemory(create=False, name=mem.name) | ||
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| mem2.close() | ||
| @@ -4466,6 +4466,11 @@ def test_shared_memory_untracking(self): | ||
| except OSError: | ||
| pass | ||
| mem.close() | ||
| @unittest.skipIf(os.name != "posix", "resource_tracker is posix only") | ||
| def test_shared_memory_tracking(self): | ||
| # gh-82300: When a separate Python process accesses shared memory | ||
| # with track=True, it must cause the memory to be deleted when | ||
| # terminating. | ||
| cmd = '''if 1: | ||
| import sys | ||
| from multiprocessing.shared_memory import SharedMemory | ||
| @@ -4475,6 +4480,7 @@ def test_shared_memory_untracking(self): | ||
| mem = shared_memory.SharedMemory(create=True, size=10) | ||
| try: | ||
| rc, out, err = script_helper.assert_python_ok("-c", cmd, mem.name) | ||
| self.assertNotIn(b"resource_tracker", err) | ||
| self.assertEqual(rc, 0) | ||
| self.assertIn( | ||
| b"resource_tracker: There appear to be 1 leaked " | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.