Commit 6970bd3
committed
gh-92408: cleanup during error handling for POSIX shared memory
`multiprocessing.shared_memory.SharedMemory` currently tries to unlink a POSIX
shared memory object if it fails to `mmap` it after opening/creating it.
However, since it only catches `OSError`, it fails to do so when opening an
existing zero-length shared memory object, as `mmap.mmap` raises a `ValueError`
when given a 0 size.
Fix this by catching all exceptions with a bare `except`, so the cleanup is run
for all errors.1 parent 4e294f6 commit 6970bd3
2 files changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4851 | 4851 | | |
4852 | 4852 | | |
4853 | 4853 | | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
| 4859 | + | |
| 4860 | + | |
| 4861 | + | |
| 4862 | + | |
| 4863 | + | |
| 4864 | + | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
| 4868 | + | |
| 4869 | + | |
| 4870 | + | |
4854 | 4871 | | |
4855 | 4872 | | |
4856 | 4873 | | |
| |||
0 commit comments