Commit 3ec7b5c
authored
Implement Windows SemLock in _multiprocessing module (#7199)
* Implement Windows SemLock in _multiprocessing module
Add SemLock class using Windows semaphore APIs (CreateSemaphoreW,
WaitForSingleObjectEx, ReleaseSemaphore) so test_multiprocessing
suites are no longer skipped with "lacks a functioning sem_open".
Also add sem_unlink as no-op and flags dict for Windows.
* Fix _multiprocessing recv to return bytes and improve SemLock reliability
- recv() now returns bytes instead of int (matching CPython)
- Remove spurious GetLastError() check after CreateSemaphoreW
- Add signal checking during blocking SemLock acquire
* Include winerror in OSError.__reduce__ on Windows
* Remove expectedFailure for tests now passing with Windows SemLock
* Fix OSError.__reduce__ to preserve winerror when filename is None
When filename is None, __reduce__ was reconstructing a 2-element
(errno, msg) tuple, dropping the winerror at position 3 in the
original args. Use the original args tuple instead, matching CPython.
* Validate maxvalue > 0 in SemLock and document winerror __reduce__ divergence
* Reject embedded null characters in mmap tagname and _winapi file mapping names1 parent f784a56 commit 3ec7b5c
6 files changed
Lines changed: 415 additions & 14 deletions
File tree
- Lib/test
- crates
- stdlib/src
- vm/src
- stdlib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4119 | 4119 | | |
4120 | 4120 | | |
4121 | 4121 | | |
4122 | | - | |
4123 | | - | |
4124 | 4122 | | |
4125 | 4123 | | |
4126 | 4124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6620 | 6620 | | |
6621 | 6621 | | |
6622 | 6622 | | |
6623 | | - | |
6624 | 6623 | | |
6625 | 6624 | | |
6626 | 6625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
560 | | - | |
| 560 | + | |
561 | 561 | | |
562 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
563 | 569 | | |
564 | 570 | | |
565 | 571 | | |
| |||
0 commit comments