Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Lib/test/test_perf_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ def baz_fork():
def foo():
pid = os.fork()
if pid == 0:
print(os.getpid())
print(os.getpid(), flush=True)
baz_fork()
os._exit(0)
else:
_, status = os.waitpid(-1, 0)
sys.exit(status)
if os.WIFSIGNALED(status):
sys.exit(1)
sys.exit(os.WEXITSTATUS(status))
def bar():
foo()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix flaky :func:`test_trampoline_works_with_forks` by using ``os._exit(0)``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roles like func can only link against objects Sphinx knows of. Test functions aren't usually documented.

in the fork child to avoid fragile Python finalization, and by flushing
stdout before exit. Also fix the parent's wait status handling to use
``os.WEXITSTATUS()``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
``os.WEXITSTATUS()``.
:func:`os.WEXITSTATUS`.

Might work, though.

Loading