diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-03 05:11:17 +0000 |
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-03 05:11:17 +0000 |
| commit | 6e4524f633aa139c005d0d9c01858319ac96d851 (patch) | |
| tree | 90136b1e3e48247754905ca991b6e75e57fe5631 | |
| parent | e361d8afd016e5874ed5ce4302df88225babdb58 (diff) | |
| download | cpython-git-6e4524f633aa139c005d0d9c01858319ac96d851.tar.gz | |
Backport (with output/test_poll):
Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
Need to check return result of PyInt_AsLong()
| -rw-r--r-- | Lib/test/output/test_poll | 2 | ||||
| -rw-r--r-- | Lib/test/test_poll.py | 20 | ||||
| -rw-r--r-- | Misc/NEWS | 2 | ||||
| -rw-r--r-- | Modules/selectmodule.c | 2 |
4 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/output/test_poll b/Lib/test/output/test_poll index 99d6fa7aa7..ca61d377de 100644 --- a/Lib/test/output/test_poll +++ b/Lib/test/output/test_poll @@ -15,3 +15,5 @@ Running poll test 1 Poll test 1 complete Running poll test 2 Poll test 2 complete +Running poll test 3 +Poll test 3 complete diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py index 2ecae69919..f99c37ff9e 100644 --- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -168,5 +168,25 @@ def test_poll2(): p.close() print 'Poll test 2 complete' +def test_poll3(): + # test int overflow + print 'Running poll test 3' + pollster = select.poll() + pollster.register(1) + + try: + pollster.poll(1L << 64) + except OverflowError: + pass + else: + print 'Expected OverflowError with excessive timeout' + + x = 2 + 3 + if x != 5: + print 'Overflow must have occurred' + print 'Poll test 3 complete' + + test_poll1() test_poll2() +test_poll3() @@ -151,6 +151,8 @@ Core and builtins Extension Modules ----------------- +- Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint + - Fix memory leak in posix.access(). - Patch #1213831: Fix typo in unicodedata._getcode. diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 81c9e3cd98..ed2ea8197c 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -470,6 +470,8 @@ poll_poll(pollObject *self, PyObject *args) return NULL; timeout = PyInt_AsLong(tout); Py_DECREF(tout); + if (timeout == -1 && PyErr_Occurred()) + return NULL; } /* Ensure the ufd array is up to date */ |
