summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "bpo-33608: Factor out a private, per-interpreter ↵Victor Stinner2019-06-031-10/+2
| | | | | _Py_AddPendingCall(). (gh-13714)" (GH-13780) This reverts commit 6a150bcaeb190d1731b38ab9c7a5d1a352847ddc.
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-06-011-2/+10
| | | | (gh-13714)
* bpo-36710: Add tstate parameter in ceval.c (GH-13547)Victor Stinner2019-05-241-2/+3
| | | | | | | | | | | | | | | | * Fix a possible reference leak in _PyErr_Print() if exception is NULL. * PyErr_BadInternalCall(): replace PyErr_Format() with _PyErr_SetString(). * Add pycore_pyerrors.h header file. * New functions: * _PyErr_Clear() * _PyErr_Fetch() * _PyErr_Print() * _PyErr_Restore() * _PyErr_SetObject() * _PyErr_SetString() * Add 'tstate' parameter to _PyEval_AddPendingCall().
* bpo-37031: Reuse _PyRuntime.main_thread in signalmodule.c (GH-13538)Victor Stinner2019-05-241-16/+16
| | | | | | | | | | Remove main_thread and main_interp variables from signalmodule.c: reuse _PyRuntime which already track the main thread and the main interpreter. * Remove #include <sys/types.h> which became useless: getpid() call has been removed. * Add runtime argument to is_main() * is_main() now gets the interpreter from runtime.
* bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not ↵Matěj Cepl2019-05-231-4/+9
| | | | | handled (GH-7778) ``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
* bpo-36710: Add 'ceval' local variable to ceval.c (GH-12934)Victor Stinner2019-05-101-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Add "struct _ceval_runtime_state *ceval = &_PyRuntime.ceval;" local variables to function to better highlight the dependency on the global variable _PyRuntime and to point directly to _PyRuntime.ceval field rather than on the larger _PyRuntime. Changes: * Add _PyRuntimeState_GetThreadState(runtime) macro. * Add _PyEval_AddPendingCall(ceval, ...) and _PyThreadState_Swap(gilstate, ...) functions. * _PyThreadState_GET() macro now calls _PyRuntimeState_GetThreadState() using &_PyRuntime. * Add 'ceval' parameter to COMPUTE_EVAL_BREAKER(), SIGNAL_PENDING_SIGNALS(), _PyEval_SignalAsyncExc(), _PyEval_SignalReceived() and _PyEval_FiniThreads() macros and functions. * Add 'tstate' parameter to call_function(), do_call_core() and do_raise(). * Add 'runtime' parameter to _Py_CURRENTLY_FINALIZING(), _Py_FinishPendingCalls() and _PyThreadState_DeleteExcept() macros and functions. * Declare 'runtime', 'tstate', 'ceval' and 'eval_breaker' variables as constant.
* bpo-36601: clarify signal handler comment and remove unnecessary pid check. ↵Jeroen Demeyer2019-05-101-15/+10
| | | | | (GH-12784) https://bugs.python.org/issue36601
* bpo-24011: Use PyModule_Add{Object,IntMacro} in PyInit__signal() (GH-12765)Joannah Nanjekye2019-04-221-7/+5
|
* bpo-33608: Revert "Factor out a private, per-interpreter ↵Eric Snow2019-04-121-9/+4
| | | | | _Py_AddPendingCall()." (gh-12806) This reverts commit f13c5c8b9401a9dc19e95d8b420ee100ac022208 (gh-12360).
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-04-121-4/+9
| | | | | (gh-12360) This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
* bpo-31904: Adapt the _signal module to VxWorks RTOS (GH-12304)pxinwr2019-03-131-0/+7
| | | Limited signal fields in VxWorks.
* Revert: bpo-33608: Factor out a private, per-interpreter ↵Victor Stinner2019-03-041-9/+4
| | | | | | | | | | | | | | | | | | | _Py_AddPendingCall(). (GH-11617) (GH-12159) * Revert "bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003)" This reverts commit bcfa450f210074e16feb761ae5b3e966a2532fcf. * Revert "bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)" This reverts commit bda918bf65a88560ec453aaba0758a9c0d49b449. * Revert "bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024)" This reverts commit b05b711a2cef6c6c381e01069dedac372e0b9fb2. * Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)" This reverts commit ef4ac967e2f3a9a18330cc6abe14adb4bc3d0465.
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-02-241-4/+9
| | | | | | | (GH-11617) This involves moving the global "pending calls" state to PyInterpreterState. https://bugs.python.org/issue33608
* bpo-35724: Explicitly require the main interpreter for signal-handling. ↵Eric Snow2019-02-231-8/+28
| | | | | | | (GH-11530) Ensure that the main interpreter is active (in the main thread) for signal-handling operations. This is increasingly relevant as people use subinterpreters more. https://bugs.python.org/issue35724
* bpo-35423: Stop using the "pending calls" machinery for signals. (gh-10972)Eric Snow2019-01-111-0/+6
| | | | | This change separates the signal handling trigger in the eval loop from the "pending calls" machinery. There is no semantic change and the difference in performance is insignificant. The change makes both components less confusing. It also eliminates the risk of changes to the pending calls affecting signal handling. This is particularly relevant for some upcoming pending calls changes I have in the works.
* bpo-35568: add 'raise_signal' function (GH-11335)Vladimir Matveev2019-01-081-0/+26
| | | | | | As in title, expose C `raise` function as `raise_function` in `signal` module. Also drop existing `raise_signal` in `_testcapi` module and replace all usages with new function. https://bugs.python.org/issue35568
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-1/+1
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)Victor Stinner2018-10-301-0/+2
| | | Add pyatomic.h to the VS project (it wasn't referenced).
* bpo-34412: Make signal.strsignal() work on HP-UX (GH-8786)Michael Osipov2018-08-231-2/+20
| | | | | | Introduce a configure check for strsignal(3) which defines HAVE_STRSIGNAL for signalmodule.c. Add some common signals on HP-UX. This change applies for Windows and HP-UX.
* bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146)pkerling2018-06-011-12/+2
|
* bpo-33441: Make the sigset_t converter available in other modules. (GH-6720)Serhiy Storchaka2018-05-081-95/+25
| | | | | | | | | * Expose the sigset_t converter via private API _Py_Sigset_Converter(). * Use Argument Clinic for parsing sigset_t in signalmodule.c. * Raise ValueError instead OverflowError for integers out of the C long range. Based on patch by Pablo Galindo Salgado.
* bpo-33332: Add signal.valid_signals() (GH-6581)Antoine Pitrou2018-05-041-5/+59
|
* bpo-33329: Fix multiprocessing regression on newer glibcs (GH-6575)Antoine Pitrou2018-04-231-6/+8
| | | | | | | Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some reserved signal numbers between 1 and NSIG. The `range(1, NSIG)` idiom is commonly used to select all signals for blocking with `pthread_sigmask`. So we ignore the sigaddset() return value until we expose sigfillset() to provide a better idiom.
* signal: add strsignal() (#6017)Antoine Pietri2018-03-121-0/+61
| | | Co-authored-by: Vajrasky Kok <sky.kok@speaklikeaking.com>
* bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792)Nathaniel J. Smith2017-12-181-53/+51
|
* bpo-30057: Fix potential missed signal in signal.signal(). (#4258)Antoine Pitrou2017-11-031-1/+4
| | | Bug report and patch by Jeroen Demeyer.
* bpo-30807: signal.setitimer() now uses _PyTime API (GH-3865)Victor Stinner2017-10-131-15/+25
| | | | | | The _PyTime API handles detects overflow and is well tested. Document that the signal will only be sent once if internal is equal to zero.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-22/+2
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (#2417)Antoine Pitrou2017-07-171-18/+20
| | | | | | | | | | | | | | * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Use _Py_atomic API for concurrency-sensitive signal state * Add blurb
* bpo-30807: signal.setitimer() may disable the timer by mistake (#2493)Antoine Pitrou2017-06-301-0/+4
| | | | | | * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb
* bpo-30703: Improve signal delivery (#2415)Antoine Pitrou2017-06-281-16/+14
| | | | | | | | | | | | | | | | | | | | * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Add stress test * Adapt for --without-threads * Add second stress test * Add NEWS blurb * Address comments @haypo
* bpo-16500: Allow registering at-fork handlers (#1715)Antoine Pitrou2017-05-271-7/+1
| | | | | | | | | | | | * bpo-16500: Allow registering at-fork handlers * Address Serhiy's comments * Add doc for new C API * Add doc for new Python-facing function * Add NEWS entry + doc nit
* bpo-30038: fix race condition in signal delivery + wakeup fd (#1082)Nathaniel J. Smith2017-05-161-7/+26
| | | | | | | | | | | | | | | | | | | Before, it was possible to get the following sequence of events (especially on Windows, where the C-level signal handler for SIGINT is run in a separate thread): - SIGINT arrives - trip_signal is called - trip_signal writes to the wakeup fd - the main thread wakes up from select()-or-equivalent - the main thread checks for pending signals, but doesn't see any - the main thread drains the wakeup fd - the main thread goes back to sleep - trip_signal sets is_tripped=1 and calls Py_AddPendingCall to notify the main thread the it should run the Python-level signal handler - the main thread doesn't notice because it's asleep This has been causing repeated failures in the Trio test suite: https://github.com/python-trio/trio/issues/119
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-1/+1
|
* bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-4/+5
| | | | | | | | | | | * bpo-6532: Make the thread id an unsigned integer. From C API side the type of results of PyThread_start_new_thread() and PyThread_get_thread_ident(), the id parameter of PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState changed from "long" to "unsigned long". * Restore a check in thread_get_ident().
* Issue #21085: add configure check for siginfo_t.si_bandZachary Ware2016-10-011-0/+4
| | | | | | | Patch by Masayuki Yamamoto, reviewed and rebased by Erik Bray. This is a first step on the long road toward resupporting Cygwin, which does not provide siginfo_t.si_band.
* Issue #28139: Merge indentation fixes from 3.5 into 3.6Martin Panter2016-09-171-7/+7
|\
| * Issue #28139: Fix messed up indentationMartin Panter2016-09-171-7/+7
| | | | | | | | | | Also update the classmethod and staticmethod doc strings and comments to match the RST documentation.
* | Use PyModule_AddIntMacro() in signal moduleChristian Heimes2016-09-081-129/+86
| | | | | | | | | | | | | | The signal module was using old-style module initialization with potential NULL dereferencing. CID 1295026
* | Issue #23524: Finish removing _PyVerify_fd from sourcesSteve Dower2016-09-081-6/+1
| |
* | replace Py_(u)intptr_t with the c99 standard typesBenjamin Peterson2016-09-061-2/+2
|/
* Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-071-26/+26
| | | | generated by Argument Clinic. Patch by Petr Viktorin.
* Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-1/+1
| | | | in places where Py_DECREF was used.
* Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|
* Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
| | | | macro Py_SETREF.
* Fixed compilation error in signalmodule.c (issue #20182).Serhiy Storchaka2015-05-161-3/+3
|
* Issue #20182: converted the signal module to use Argument ClinicTal Einat2015-05-161-215/+246
|
* Issue #23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() ofVictor Stinner2015-04-011-3/+4
| | | | signalmodule.c
* PEP 475: on EINTR, retry the function even if the timeout is equals to zeroVictor Stinner2015-03-301-1/+1
| | | | | | | | | Retry: * signal.sigtimedwait() * threading.Lock.acquire() * threading.RLock.acquire() * time.sleep()