Skip to content

Commit 5e815cc

Browse files
πŸ“œπŸ€– Added by blurb_it.
1 parent 6f97f0a commit 5e815cc

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Fixes gh-103758.
2+
Supersedes and closes gh-103759.
3+
4+
### Summary
5+
Adds a regression test in `Lib/test/test_os/test_posix.py` to verify that registering callbacks multiple times via `os.register_at_fork()` correctly preserves both old and newly registered handlers across successive forks.
6+
7+
Specifically, it verifies:
8+
- `before` handlers execute in LIFO (reverse) order.
9+
- `after_in_parent` handlers execute in FIFO order.
10+
- `after_in_child` handlers execute in FIFO order.
11+
- Handlers registered after an earlier fork accumulate and run alongside previous generations in subsequent forks.
12+
13+
### Note on Previous Work
14+
This issue was originally reported by @itsankitkp with an initial implementation in #103759.
15+
16+
This PR supersedes #103759 by addressing reliability issues in the earlier attempt:
17+
- Eliminates multi-process race conditions on a shared pipe by validating events per-process in memory.
18+
- Eliminates pipe token-starvation deadlocks on child exit.
19+
- Uses `test.support.wait_process` to reap child processes cleanly and verify exit status.
20+
21+
Credit is attributed to the original author via the commit trailer (`Co-authored-by`).
22+
23+
### Checklist
24+
- [x] Tested locally with `./python -m test -v test_os.test_posix`
25+
- [x] All required CI checks passed cleanly
26+
- [x] No NEWS entry required (test-only change as per Devguide)

0 commit comments

Comments
Β (0)