mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
Need to check return result of PyInt_AsLong() Will backport.
This commit is contained in:
parent
26f4c23074
commit
0f46bbf781
3 changed files with 24 additions and 0 deletions
|
@ -168,5 +168,25 @@ def test_poll2():
|
||||||
p.close()
|
p.close()
|
||||||
print 'Poll test 2 complete'
|
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_poll1()
|
||||||
test_poll2()
|
test_poll2()
|
||||||
|
test_poll3()
|
||||||
|
|
|
@ -177,6 +177,8 @@ Core and builtins
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
|
||||||
|
|
||||||
- Bug #1344508, Fix UNIX mmap leaking file descriptors
|
- Bug #1344508, Fix UNIX mmap leaking file descriptors
|
||||||
|
|
||||||
- Patch #1338314, Bug #1336623: fix tarfile so it can extract
|
- Patch #1338314, Bug #1336623: fix tarfile so it can extract
|
||||||
|
|
|
@ -470,6 +470,8 @@ poll_poll(pollObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
timeout = PyInt_AsLong(tout);
|
timeout = PyInt_AsLong(tout);
|
||||||
Py_DECREF(tout);
|
Py_DECREF(tout);
|
||||||
|
if (timeout == -1 && PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the ufd array is up to date */
|
/* Ensure the ufd array is up to date */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue