Commit Graph

193 Commits

Author SHA1 Message Date
Miss Islington (bot) 623b439abe bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) (GH-7306)
(cherry picked from commit e905c84494)

Co-authored-by: pkerling <pkerling@casix.org>
2018-06-01 12:50:24 +02:00
Miss Islington (bot) 75a3e3d5bc bpo-33329: Fix multiprocessing regression on newer glibcs (GH-6575) (GH-6579)
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.
(cherry picked from commit 25038ecfb6)

Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2018-04-23 21:42:26 +02:00
Nathaniel J. Smith 902ab80b59 bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792) 2017-12-17 23:10:18 -05:00
Antoine Pitrou f6f90ff079
bpo-30057: Fix potential missed signal in signal.signal(). (#4258)
Bug report and patch by Jeroen Demeyer.
2017-11-03 19:58:46 +01:00
Victor Stinner ef611c96ea bpo-30807: signal.setitimer() now uses _PyTime API (GH-3865)
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.
2017-10-13 13:49:43 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Antoine Pitrou 2c8a5e4c96 bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (#2417)
* 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
2017-07-17 12:25:19 +02:00
Antoine Pitrou 729780a810 bpo-30807: signal.setitimer() may disable the timer by mistake (#2493)
* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb
2017-06-30 10:01:05 +02:00
Antoine Pitrou c08177a1cc bpo-30703: Improve signal delivery (#2415)
* 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
2017-06-28 23:29:29 +02:00
Antoine Pitrou 346cbd351e bpo-16500: Allow registering at-fork handlers (#1715)
* 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
2017-05-27 17:50:54 +02:00
Nathaniel J. Smith 4ae0149697 bpo-30038: fix race condition in signal delivery + wakeup fd (#1082)
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
2017-05-16 23:12:11 +02:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Serhiy Storchaka aefa7ebf0f bpo-6532: Make the thread id an unsigned integer. (#781)
* 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().
2017-03-23 14:48:39 +01:00
Zachary Ware 6a6967e827 Issue #21085: add configure check for siginfo_t.si_band
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.
2016-10-01 00:47:27 -05:00
Martin Panter d508d00919 Issue #28139: Merge indentation fixes from 3.5 into 3.6 2016-09-17 07:59:14 +00:00
Martin Panter 6d57fe1c23 Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Christian Heimes 6782b14bcb Use PyModule_AddIntMacro() in signal module
The signal module was using old-style module initialization with
potential NULL dereferencing.

CID 1295026
2016-09-09 00:11:45 +02:00
Steve Dower 940f33a50f Issue #23524: Finish removing _PyVerify_fd from sources 2016-09-08 11:21:54 -07:00
Benjamin Peterson ca47063998 replace Py_(u)intptr_t with the c99 standard types 2016-09-06 13:47:26 -07:00
Serhiy Storchaka 1a2b24f02d Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Serhiy Storchaka 57a01d3a0e Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka 48842714b9 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:45:48 +03:00
Serhiy Storchaka 5a57ade58e Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Serhiy Storchaka 6b680cd6b2 Fixed compilation error in signalmodule.c (issue #20182). 2015-05-16 15:57:56 +03:00
Tal Einat c7027b7904 Issue #20182: converted the signal module to use Argument Clinic 2015-05-16 14:14:49 +03:00
Victor Stinner e72fe3995b Issue #23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() of
signalmodule.c
2015-04-01 18:35:22 +02:00
Victor Stinner 6aa446cf03 PEP 475: on EINTR, retry the function even if the timeout is equals to zero
Retry:

* signal.sigtimedwait()
* threading.Lock.acquire()
* threading.RLock.acquire()
* time.sleep()
2015-03-30 21:33:51 +02:00
Victor Stinner e134a7fe36 Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
2015-03-30 10:09:31 +02:00
Victor Stinner 869e1778c0 Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILING
All these functions only accept positive timeouts, so this change has no effect
in practice.
2015-03-30 03:49:14 +02:00
Victor Stinner 34dc0f46ae Issue #22117: The signal modules uses the new _PyTime_t API
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
2015-03-27 18:19:03 +01:00
Victor Stinner a453cd8d85 Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
when interrupted by a signal not in the *sigset* parameter, if the signal
handler does not raise an exception. signal.sigtimedwait() recomputes the
timeout with a monotonic clock when it is retried.

Remove test_signal.test_sigwaitinfo_interrupted() because sigwaitinfo() doesn't
raise InterruptedError anymore if it is interrupted by a signal not in its
sigset parameter.
2015-03-20 12:54:28 +01:00
Steve Dower 8acde7dcce Issue #23524: Change back to using Windows errors for _Py_fstat instead of the errno shim. 2015-03-07 18:14:07 -08:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Victor Stinner cf40a9e640 Issue #23450: Fix signal.set_wakeup_fd() on Windows
Detect integer overflow on the file descriptor of the socket on 64-bit Python.
2015-02-12 16:34:54 +01:00
Nick Coghlan d600951748 Issue #22869: Split pythonrun into two modules
- interpreter startup and shutdown code moved to a new
  pylifecycle.c module
- Py_OptimizeFlag moved into the new module with the other
  global flags
2014-11-20 21:39:37 +10:00
Victor Stinner 3822760f2d Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file
descriptor is in blocking mode.
2014-08-27 12:59:44 +02:00
Victor Stinner 115171086a Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets.
A side effect is that Python depends to the WinSock library.
2014-07-29 23:31:34 +02:00
Victor Stinner 1d8948e023 Backout 42ced0d023cd: oops, i didn't want to push this changeset :-/ 2014-07-24 22:51:05 +02:00
Victor Stinner d18ccd19f0 tets 2014-07-24 21:58:53 +02:00
Victor Stinner 0bffc94d57 Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a
ValueError on fstat() failure.
2014-07-21 16:28:54 +02:00
Brett Cannon 815a6f38a6 merge along w/ fix for issue #2107 (commit c9239171e429) 2014-04-04 10:20:28 -04:00
Giampaolo Rodola' e09fb7198a fix #21076: turn signal module constants into enums 2014-04-04 15:34:17 +02:00
Victor Stinner 3c1b379ebd Issue #20320: select.select() and select.kqueue.control() now round the timeout
aways from zero, instead of rounding towards zero.

It should make test_asyncio more reliable, especially test_timeout_rounding() test.
2014-02-17 00:02:43 +01:00
Serhiy Storchaka dfe98a102e Issue #20437: Fixed 22 potential bugs when deleting objects references. 2014-02-09 13:46:20 +02:00
Serhiy Storchaka 505ff755d7 Issue #20437: Fixed 21 potential bugs when deleting objects references. 2014-02-09 13:33:53 +02:00
Christian Heimes 44ed3de6f4 Issue #18774: Remove last bits of GNU PTH thread code, patch by Vajrasky Kok. 2013-08-18 12:43:24 +02:00
Antoine Pitrou 6f6ec37838 Issue #16105: When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, report an exception instead of ignoring the error. 2013-08-17 20:27:56 +02:00
Victor Stinner 1c8f059019 Issue #18520: Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).

 * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
 * Fix also some calls to PyDict_SetItemString(): handle error
2013-07-22 22:24:54 +02:00
Antoine Pitrou 52c5f85cf9 Issue #14173: Avoid crashing when reading a signal handler during interpreter shutdown. 2013-05-04 23:21:09 +02:00
Antoine Pitrou c8c952ce2a Issue #14173: Avoid crashing when reading a signal handler during interpreter shutdown. 2013-05-04 23:16:59 +02:00