[Python-checkins] r50811 - python/trunk/Lib/test/test_sys.py

tim.peters python-checkins at python.org
Tue Jul 25 06:07:23 CEST 2006


Author: tim.peters
Date: Tue Jul 25 06:07:22 2006
New Revision: 50811

Modified:
   python/trunk/Lib/test/test_sys.py
Log:
current_frames_with_threads():  There's actually no way
to guess /which/ line the spawned thread is in at the time
sys._current_frames() is called:  we know it finished
enter_g.set(), but can't know whether the instruction
counter has advanced to the following leave_g.wait().
The latter is overwhelming most likely, but not guaranteed,
and I see that the "x86 Ubuntu dapper (icc) trunk" buildbot
found it on the other line once.  Changed the test so it
passes in either case.


Modified: python/trunk/Lib/test/test_sys.py
==============================================================================
--- python/trunk/Lib/test/test_sys.py	(original)
+++ python/trunk/Lib/test/test_sys.py	Tue Jul 25 06:07:22 2006
@@ -274,8 +274,9 @@
         t.start()
         entered_g.wait()
 
-        # At this point, t has finished its entered_g.set(), and is blocked
-        # in its leave_g.wait().
+        # At this point, t has finished its entered_g.set(), although it's
+        # impossible to guess whether it's still on that line or has moved on
+        # to its leave_g.wait().
         self.assertEqual(len(thread_info), 1)
         thread_id = thread_info[0]
 
@@ -305,7 +306,7 @@
         # And the next record must be for g456().
         filename, lineno, funcname, sourceline = stack[i+1]
         self.assertEqual(funcname, "g456")
-        self.assertEqual(sourceline, "leave_g.wait()")
+        self.assert_(sourceline in ["leave_g.wait()", "entered_g.set()"])
 
         # Reap the spawned thread.
         leave_g.set()


More information about the Python-checkins mailing list