[Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Mon Dec 20 02:05:30 CET 2010
- Previous message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Next message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Functions used by the fault handler: - write() - PyUnicodeCheck() - PyFrameGetLineNumber() - DebugBreak() (Windows, in debug mode, only) - abort() - (macro) PyUnicodeGETSIZE() and PyUnicodeASUNICODE() - PyUnicodeCheck(), PyFrameCheck() - PyFrameGetLineNumber() - Pyatomicloadrelaxed() - PyThreadStateGetFrame()
I suppose that all Py() functions are POSIX compliants.
The problem is that merely being POSIX compliant would not be enough to allow calling a function in a signal handler. Instead, the function also needs to be async-signal safe. However,
- abort() conforms to SVr4, POSIX.1-2001, 4.3BSD, C89, C99. - write() conforms to SVr4, 4.3BSD, POSIX.1-2001
These two functions are indeed async-signal safe. So assuming that none of the functions above indirectly calls a non-async-signal-safe function, this part is fine.
Looking at your function list, my other concern is that you are calling Python API without holding the GIL, IIUC. In particular, you are accessing _PyThreadState_Current, which may not point to the current thread if the current thread has released the GIL.
Regards, Martin
- Previous message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Next message: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]