[Python-checkins] commit of r41390 - in python/branches/release24-maint: Lib/test Lib/test/output Misc Modules

neal.norwitz@python.org neal.norwitz at python.org
Thu Nov 3 06:11:19 CET 2005


Author: neal.norwitz
Date: Thu Nov  3 06:11:17 2005
New Revision: 41390

Modified:
   python/branches/release24-maint/Lib/test/output/test_poll
   python/branches/release24-maint/Lib/test/test_poll.py
   python/branches/release24-maint/Misc/NEWS
   python/branches/release24-maint/Modules/selectmodule.c
Log:
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()



Modified: python/branches/release24-maint/Lib/test/output/test_poll
==============================================================================
--- python/branches/release24-maint/Lib/test/output/test_poll	(original)
+++ python/branches/release24-maint/Lib/test/output/test_poll	Thu Nov  3 06:11:17 2005
@@ -15,3 +15,5 @@
 Poll test 1 complete
 Running poll test 2
 Poll test 2 complete
+Running poll test 3
+Poll test 3 complete

Modified: python/branches/release24-maint/Lib/test/test_poll.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_poll.py	(original)
+++ python/branches/release24-maint/Lib/test/test_poll.py	Thu Nov  3 06:11:17 2005
@@ -168,5 +168,25 @@
     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()

Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Thu Nov  3 06:11:17 2005
@@ -151,6 +151,8 @@
 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.

Modified: python/branches/release24-maint/Modules/selectmodule.c
==============================================================================
--- python/branches/release24-maint/Modules/selectmodule.c	(original)
+++ python/branches/release24-maint/Modules/selectmodule.c	Thu Nov  3 06:11:17 2005
@@ -470,6 +470,8 @@
 			return NULL;
 		timeout = PyInt_AsLong(tout);
 		Py_DECREF(tout);
+		if (timeout == -1 && PyErr_Occurred())
+			return NULL;
 	}
 
 	/* Ensure the ufd array is up to date */


More information about the Python-checkins mailing list