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
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
3be08b4f50812acbc843171384476bbfca6db79426db11894d44cb82c62cff0dcda10f63d21d7e990e419c593ba9ef1ff3e5fe67466acf903fdf625d65e3f8a97c6d317c07f513f3fb67c7f0e7765afb7a5848c18255e015d8911766db5b852053f8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4443,24 +4443,28 @@ def test_shared_memory_cleaned_after_process_termination(self): | ||
| @unittest.skipIf(os.name != "posix", "resource_tracker is posix only") | ||
| 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 | ||
| mem = SharedMemory(create=False, name=sys.argv[1], track=False) | ||
| mem.close() | ||
| ''' | ||
| mem = shared_memory.SharedMemory(create=True, size=10) | ||
| rc, out, err = script_helper.assert_python_ok("-c", cmd, mem.name) | ||
| # The resource tracker shares pipes with the subprocess, and so | ||
| # err existing means that the tracker process has terminated now. | ||
| try: | ||
| 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() | ||
| finally: | ||
| mem.close() | ||
| try: | ||
| mem.unlink() | ||
| except OSError: | ||
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| pass | ||
| # | ||
| # Test to verify that `Finalize` works. | ||