Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-101100: Fix Sphinx warnings in library/faulthandler.rst #118353

Merged
merged 1 commit into from Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions Doc/library/faulthandler.rst
Expand Up @@ -10,14 +10,15 @@

This module contains functions to dump Python tracebacks explicitly, on a fault,
after a timeout, or on a user signal. Call :func:`faulthandler.enable` to
install fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`,
:const:`SIGABRT`, :const:`SIGBUS`, and :const:`SIGILL` signals. You can also
install fault handlers for the :const:`~signal.SIGSEGV`,
:const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and
:const:`~signal.SIGILL` signals. You can also
enable them at startup by setting the :envvar:`PYTHONFAULTHANDLER` environment
variable or by using the :option:`-X` ``faulthandler`` command line option.

The fault handler is compatible with system fault handlers like Apport or the
Windows fault handler. The module uses an alternative stack for signal handlers
if the :c:func:`sigaltstack` function is available. This allows it to dump the
if the :c:func:`!sigaltstack` function is available. This allows it to dump the
traceback even on a stack overflow.

The fault handler is called on catastrophic cases and therefore can only use
Expand Down Expand Up @@ -70,8 +71,9 @@ Fault handler state

.. function:: enable(file=sys.stderr, all_threads=True)

Enable the fault handler: install handlers for the :const:`SIGSEGV`,
:const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and :const:`SIGILL`
Enable the fault handler: install handlers for the :const:`~signal.SIGSEGV`,
:const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`
and :const:`~signal.SIGILL`
signals to dump the Python traceback. If *all_threads* is ``True``,
produce tracebacks for every running thread. Otherwise, dump only the current
thread.
Expand Down Expand Up @@ -106,8 +108,8 @@ Dumping the tracebacks after a timeout

Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or
every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, call
:c:func:`_exit` with status=1 after dumping the tracebacks. (Note
:c:func:`_exit` exits the process immediately, which means it doesn't do any
:c:func:`!_exit` with status=1 after dumping the tracebacks. (Note
:c:func:`!_exit` exits the process immediately, which means it doesn't do any
Comment on lines +111 to +112
Copy link
Member

Choose a reason for hiding this comment

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

Is this the same as https://docs.python.org/3/library/os.html#os._exit? Should this link to that, maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so, it's calling the C one from unistd.h:

# include <unistd.h> // _exit()

if (thread.exit)
_exit(1);

Copy link
Member

Choose a reason for hiding this comment

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

I think os._exit is just a very thin wrapper around the C one:

cpython/Modules/posixmodule.c

Lines 6613 to 6619 in e0ab642

static PyObject *
os__exit_impl(PyObject *module, int status)
/*[clinic end generated code: output=116e52d9c2260d54 input=5e6d57556b0c4a62]*/
{
_exit(status);
return NULL; /* Make gcc -Wall happy */
}

But yes, good point, they're not exactly the same!

cleanup like flushing file buffers.) If the function is called twice, the new
call replaces previous parameters and resets the timeout. The timer has a
sub-second resolution.
Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Expand Up @@ -28,7 +28,6 @@ Doc/library/email.errors.rst
Doc/library/email.parser.rst
Doc/library/email.policy.rst
Doc/library/exceptions.rst
Doc/library/faulthandler.rst
Doc/library/functools.rst
Doc/library/http.cookiejar.rst
Doc/library/http.server.rst
Expand Down