Commit Graph

259 Commits

Author SHA1 Message Date
Siddhesh Poyarekar 55edd0c185 bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments.  This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
2018-04-29 21:59:33 +03:00
oldk aa0735f597 bpo-32747: Remove trailing spaces in docstrings. (GH-5491) 2018-02-02 10:52:55 +02:00
Victor Stinner b8d90328ad
bpo-28914: Fix compilation of select on Android (#5447)
EPOLL_CLOEXEC is not defined on Android.

Co-Authored-By: Wataru Matsumoto <sxsns243@gmail.com>
2018-01-30 12:18:54 +01:00
stratakis e8b1965639 bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793) 2017-11-02 20:32:54 +10:00
Serhiy Storchaka 2298fad5ff
bpo-31893: Fix errors in b9052a0f91. (#4196)
* Fix a compilation error on FreeBSD.
* Fix the data attribute size on Mac OS X.
2017-10-31 18:18:21 +02:00
Serhiy Storchaka b9052a0f91
bpo-31893: Fixed select.kqueue(). (#4166)
* Fixed the layout of the kqueue_event structure on OpenBSD and NetBSD.
* Fixed the comparison of the kqueue_event objects.
2017-10-31 13:59:55 +02:00
Riccardo Coccioli 6cfa927ceb bpo-31334: Fix timeout in select.poll.poll() (GH-3277)
Always pass -1, or INFTIM where defined, to the poll() system call when
a negative timeout is passed to the poll.poll([timeout]) method in the
select module. Various OSes throw an error with arbitrary negative
values.
2017-10-17 12:45:07 -07:00
Pablo Galindo 2c15b29aea bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (#4003) 2017-10-17 17:14:41 +03:00
Serhiy Storchaka de07210077 bpo-30058: Fixed buffer overflow in select.kqueue.control(). (#1095) 2017-10-12 22:17:46 +03:00
Serhiy Storchaka bf623ae884 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)
raised an error.

Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03: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 783d0c1a1c bpo-28667: Fix a compile warning on FreeBSD when compare with FD_SETSIZE. (#501)
FreeBSD is the only platforms with unsigned FD_SETSIZE.
2017-03-12 14:43:12 +02:00
Serhiy Storchaka 228b12edcc Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible.  Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka 5ab81d787f Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. 2016-12-16 16:18:57 +02:00
Berker Peksag e2197d1312 Issue #20100: Simplify newPyEpoll_Object()
EPOLL_CLOEXEC is the only value that can be passed
to epoll_create1() and we are passing EPOLL_CLOEXEC
unconditionally since Python 3.4.
2016-09-26 23:30:41 +03:00
Berker Peksag 7ec64562b2 Issue #28153: Make kqueue()'s event filters optional
Patch by Ed Schouten.
2016-09-14 18:16:59 +03:00
Benjamin Peterson ca47063998 replace Py_(u)intptr_t with the c99 standard types 2016-09-06 13:47:26 -07:00
Berker Peksag e1d22fda7e Expose EPOLLRDHUP conditionally 2016-08-08 13:39:43 +03:00
Berker Peksag fe8d966657 Issue #27567: Expose the POLLRDHUP constant in the select module 2016-07-19 21:09:26 +03:00
Benjamin Peterson 0715ce358a add EPOLLEXCLUSIVE 2016-07-18 22:02:44 -07:00
Benjamin Peterson 96e97169cc expose EPOLLRDHUP (closes #27567) 2016-07-18 21:47:39 -07:00
Senthil Kumaran 0594cff293 merge from 3.5
issue27018 - Fix the documentation of select.epoll.register method.
2016-05-14 21:29:03 -07:00
Senthil Kumaran 507898d35d issue27018 - Fix the documentation of select.epoll.register method. 2016-05-14 21:28:22 -07:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 2d06e84455 Issue #25923: Added the const qualifier to static constant arrays. 2015-12-25 19:53:18 +02:00
Benjamin Peterson e5df40727c merge 3.4 (#25371) 2015-10-10 19:32:33 -07:00
Benjamin Peterson b397e3b526 add a missing comma (closes #25371) 2015-10-10 19:32:20 -07:00
Zachary Ware 3e77677692 Issue #23652: Make the select module compile against LSB headers.
Patch by Matt Frank.
2015-08-01 21:34:05 -05:00
Zachary Ware 1824544d82 Issue #23652: Merge with 3.4 2015-08-01 21:38:04 -05:00
Victor Stinner 45ca48b03d Issue #23485: select.devpoll.poll() is now retried when interrupted by a signal 2015-03-31 12:10:33 +02:00
Victor Stinner 4448c08451 Issue #23485: select.kqueue.control() is now retried when interrupted by a signal 2015-03-31 11:48:34 +02:00
Victor Stinner 41eba224de Issue #23485: select.epoll.poll() is now retried when interrupted by a signal 2015-03-30 21:59:21 +02:00
Victor Stinner 3c7d6e0693 Issue #23485: select.poll.poll() is now retried when interrupted by a signal 2015-03-30 21:38:00 +02:00
Victor Stinner f70e1ca0fc Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.

The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
2015-03-30 21:16:11 +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 c337838af7 Issue #22117: Use the new _PyTime_t API in the select module 2015-03-28 05:07:51 +01:00
Victor Stinner 54799672da Issue #23708: select.devpoll now retries its internal write() when interrupted
by a signal (EINTR).

Modify devpoll_flush() to use _Py_write() instead of calling directly write().
2015-03-19 23:33:09 +01:00
Victor Stinner a555cfcb73 Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
  OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
  held
2015-03-18 00:22:14 +01:00
Victor Stinner 329e492570 Issue #20656: Restore explicit downcast in select_select().
Cast from time_t (64 bit) to long (32 bit). It should fix a compiler warning.
2014-02-18 09:30:33 +01:00
Victor Stinner 5a8e5796f1 Close #20656: Fix select.select() on OpenBSD 64-bit 2014-02-18 01:35:40 +01: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
Victor Stinner dcd9740ad2 Issue #20452: select and selectors round (again) timeout away from zero for
poll and epoll

Improve also debug info to analyze the issue
2014-01-31 12:12:53 +01:00
Victor Stinner 38c72bd199 (Merge 3.3) Issue #20311: Revert 033137c12d88 (02f9db3e684e),
select.epoll.poll() rounds again the timeout towards zero
2014-01-25 14:40:04 +01:00
Victor Stinner 933209689e Issue #20311: Revert 033137c12d88, select.epoll.poll() rounds again the timeout
towards zero
2014-01-25 14:37:50 +01:00
Victor Stinner 09354fd606 (Merge 3.3) Issue #20311: select.epoll.poll() now rounds the timeout away from
zero, instead of rounding towards zero. For example, a timeout of one
microsecond is now rounded to one millisecond, instead of being rounded to
zero.
2014-01-21 01:42:11 +01:00
Victor Stinner 665486e0e7 Issue #20311: select.epoll.poll() now rounds the timeout away from zero,
instead of rounding towards zero. For example, a timeout of one microsecond is
now rounded to one millisecond, instead of being rounded to zero.
2014-01-21 01:41:00 +01:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Serhiy Storchaka 03241e8017 Issue #17919: Fixed integer overflow in the eventmask parameter. 2013-12-14 19:18:39 +02:00
Serhiy Storchaka 5da107ac72 Issue #17919: Fixed integer overflow in the eventmask parameter. 2013-12-14 19:12:02 +02:00
Serhiy Storchaka cb1c4c8c22 Issue #17919: select.poll.poll() again works with poll.POLLNVAL on AIX. 2013-12-13 12:08:55 +02:00
Serhiy Storchaka 3ad2d70947 Issue #17919: select.poll.poll() again works with poll.POLLNVAL on AIX. 2013-12-13 12:08:01 +02:00
Guido van Rossum ee07b94788 Fix indentation of switch cases. 2013-12-06 17:46:22 -08:00
Victor Stinner 7613542a27 Issue #19437: Fix select.epoll.poll(), fix code handling PyMem_New() error
The bug was introduced with the select.epoll module! So it's 5 years old :-)
2013-10-30 19:57:52 +01:00
Victor Stinner d72fe89b80 select.epoll.fromfd(fd) must be not change the inheritable flag of the file
descriptor
2013-08-28 12:22:39 +02:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Christian Heimes 9dd279a3ac Issue #11973: Fix a problem in kevent. The flags and fflags fields are now
properly handled as unsigned.
2013-08-25 14:57:38 +02:00
Christian Heimes f1fe159822 Issue #11973: Fix a problem in kevent. The flags and fflags fields are now
properly handled as unsigned.
2013-08-25 14:57:00 +02:00
Richard Oudkerk a93bf7b9a6 Fix devpoll_dealloc(). 2013-08-22 14:03:44 +01:00
Richard Oudkerk 168d59b669 Move definition of devpoll_internal_close() before devpoll_close(). 2013-08-22 13:31:15 +01:00
Richard Oudkerk 069d65c35a Fix compilation of select module on Solaris. 2013-08-22 13:04:23 +01:00
Victor Stinner 13423c3726 Close #18794: Add a fileno() method and a closed attribute to select.devpoll
objects.

Add also tests on fileno() method and closed attribute of select.epoll and select.kqueue.
2013-08-22 00:19:50 +02:00
Serhiy Storchaka 5617df1be6 Issue #8865: Concurrent invocation of select.poll.poll() now raises a
RuntimeError exception.  Patch by Christian Schubert.
2013-08-20 20:50:32 +03:00
Serhiy Storchaka b1973c252c Issue #8865: Concurrent invocation of select.poll.poll() now raises a
RuntimeError exception.  Patch by Christian Schubert.
2013-08-20 20:38:21 +03:00
Victor Stinner bbf8ce5b87 Issue #18408: Fix select.select() to handle PyList_New() failure (MemoryError)
in set2list()
2013-07-09 00:49:03 +02:00
Charles-Francois Natali 74ca886788 Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()
when applicable.
2013-05-20 19:13:19 +02:00
Charles-Francois Natali b1294fa9f4 Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit
platforms. Patch by Federico Schwindt.
2013-05-06 21:26:05 +02:00
Charles-Francois Natali 002a77d2f7 Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit
platforms. Patch by Federico Schwindt.
2013-05-06 21:24:31 +02:00
Charles-François Natali c07fcbb698 Issue #16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL.
Patch by Jeffrey Armstrong.
2013-01-19 12:39:29 +01:00
Charles-François Natali 95195b35b8 Issue #16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL.
Patch by Jeffrey Armstrong.
2013-01-19 12:21:26 +01:00
Charles-François Natali 986a56cefe Issue #16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL.
Patch by Jeffrey Armstrong.
2013-01-19 12:19:10 +01:00
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka 441d30fac7 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Serhiy Storchaka 7898043868 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
2013-01-15 01:12:17 +02:00
Charles-François Natali a6ebb2d7fb Issue #16876: Revert be8e6b81284e, which wasn't thread-safe: wait until a
solution is found for poll().
2013-01-12 12:31:00 +01:00
Charles-François Natali f424f3856d Issue #16876: Optimize epoll.poll() by keeping a per-instance epoll events
buffer instead of allocating a new one at each poll().
2013-01-09 19:00:26 +01:00
Antoine Pitrou 09bb89b8cf Issue #16488: epoll() objects now support the `with` statement.
Patch by Serhiy Storchaka.
2012-12-15 21:14:21 +01:00
Antoine Pitrou 787fbe9d6b Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
2012-11-01 20:16:07 +01:00
Antoine Pitrou 0168d3d9b1 Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
2012-11-01 20:15:23 +01:00
Antoine Pitrou e4ad37e50e Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
2012-11-01 20:13:54 +01:00
Jesus Cea 14c81aba50 #16135: Removal of OS/2 support (Modules/*) 2012-10-05 02:11:36 +02:00
Benjamin Peterson 6f3e5e48d3 remove useless and defined initialization (closes #15921) 2012-09-11 12:05:05 -04:00
Jesus Cea 024abca053 MERGE: Closes #15395: memory leaks in selectmodule.c 2012-07-19 21:32:07 +02:00
Jesus Cea 62a5c3216d Closes #15395: memory leaks in selectmodule.c 2012-07-19 21:31:26 +02:00
Brett Cannon 8798ad3e1e struct timeval.tv_usec is 4 bytes on 64-bit OS X as it should be, but
is defined as an int while everyone else expects a long regardless of
length.
2012-04-07 14:59:29 -04:00
Victor Stinner b2a3773301 Issue #14180: Fix the select module to handle correctly the Windows timeval
structure. timeval.tv_sec is a long on Windows, not time_t.
2012-03-14 00:20:51 +01:00
Victor Stinner d528b01a71 Issue #14180: Fix another typo in kqueue_queue_control() 2012-03-13 16:25:35 +01:00
Victor Stinner d327f9de1f Issue #14180: Fix select.select() compilation on BSD and a typo in kqueue_queue_control() 2012-03-13 15:29:08 +01:00
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Benjamin Peterson 83251c1ecd try to always use the old API 2011-12-27 16:01:21 -06:00
Benjamin Peterson 95c16629d3 fix for old kernels which don't have epoll_create1 2011-12-27 15:36:32 -06:00
Benjamin Peterson 2fb9ae9dfc add a flags parameter to select.epoll 2011-12-27 15:15:41 -06:00
Jesus Cea d8b9ae6e8f Issue #6397: Support '/dev/poll' polling objects in select module, under Solaris & derivatives. 2011-11-14 19:07:41 +01:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Charles-François Natali ac7e9e058d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
2011-08-28 18:10:27 +02:00
Charles-François Natali aa26b27503 Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
2011-08-28 17:51:43 +02:00
Benjamin Peterson dd6098b8a1 merge 3.2 2011-06-27 09:16:40 -05:00
Senthil Kumaran 7d80bd1909 Fix closes issue 11568 - update select.epoll.register docstring with mention of correct behavior. 2011-06-26 23:48:23 -07:00
Antoine Pitrou 131a6414dd Issue #11757: select.select() now raises ValueError when a negative timeout
is passed (previously, a select.error with EINVAL would be raised).  Patch
by Charles-François Natali.
2011-04-09 23:49:58 +02:00