summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-08-11 00:49:01 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-08-11 00:49:01 (GMT)
commit08574770c54dcab5f44bc77e39fa1689beea2f84 (patch)
tree188a656c901956f42f1e413c9507165d22a4605d /Lib
parentb7ad1eb2c6ad9a331ddc3a32d0d2780981f0d316 (diff)
downloadcpython-08574770c54dcab5f44bc77e39fa1689beea2f84.zip
cpython-08574770c54dcab5f44bc77e39fa1689beea2f84.tar.gz
cpython-08574770c54dcab5f44bc77e39fa1689beea2f84.tar.bz2
test_PyThreadState_SetAsyncExc(): This is failing on some
64-bit boxes. I have no idea what the ctypes docs mean by "integers", and blind-guessing here that it intended to mean the signed C "int" type, in which case perhaps I can repair this by feeding the thread id argument to type ctypes.c_long(). Also made the worker thread daemonic, so it doesn't hang Python shutdown if the test continues to fail.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_threading.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 1d99fa7..8614ecb 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -169,14 +169,15 @@ class ThreadTests(unittest.TestCase):
worker_saw_exception.set()
t = Worker()
+ t.setDaemon(True) # so if this fails, we don't hang Python at shutdown
+ t.start()
if verbose:
print " started worker thread"
- t.start()
# Try a thread id that doesn't make sense.
if verbose:
print " trying nonsensical thread id"
- result = set_async_exc(-1, exception)
+ result = set_async_exc(ctypes.c_long(-1), exception)
self.assertEqual(result, 0) # no thread states modified
# Now raise an exception in the worker thread.
@@ -188,7 +189,7 @@ class ThreadTests(unittest.TestCase):
self.assert_(not t.finished)
if verbose:
print " attempting to raise asynch exception in worker"
- result = set_async_exc(t.id, exception)
+ result = set_async_exc(ctypes.c_long(t.id), exception)
self.assertEqual(result, 1) # one thread state modified
if verbose:
print " waiting for worker to say it caught the exception"