[Python-checkins] python/dist/src/Lib trace.py,1.7,1.8

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
2003年6月26日 07:56:19 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv25714
Modified Files:
	trace.py 
Log Message:
Enable tracing of multi-threaded applications.
Fix bug in computation of coverage percentage: Only count a line if it
was executed or if we print the >>>>>> marker.
Index: trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** trace.py	24 Apr 2003 16:02:43 -0000	1.7
--- trace.py	26 Jun 2003 14:56:17 -0000	1.8
***************
*** 51,54 ****
--- 51,55 ----
 import re
 import sys
+ import threading
 import token
 import tokenize
***************
*** 318,324 ****
 if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]:
 outfile.write(">>>>>> ")
 else:
 outfile.write(" ")
- n_lines += 1
 outfile.write(lines[i].expandtabs(8))
 outfile.close()
--- 319,325 ----
 if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]:
 outfile.write(">>>>>> ")
+ n_lines += 1
 else:
 outfile.write(" ")
 outfile.write(lines[i].expandtabs(8))
 outfile.close()
***************
*** 438,441 ****
--- 439,443 ----
 if not self.donothing:
 sys.settrace(self.globaltrace)
+ threading.settrace(self.globaltrace)
 try:
 exec cmd in dict, dict
***************
*** 443,446 ****
--- 445,449 ----
 if not self.donothing:
 sys.settrace(None)
+ threading.settrace(None)
 
 def runctx(self, cmd, globals=None, locals=None):
***************
*** 449,452 ****
--- 452,456 ----
 if not self.donothing:
 sys.settrace(self.globaltrace)
+ threading.settrace(self.globaltrace)
 try:
 exec cmd in globals, locals
***************
*** 454,457 ****
--- 458,462 ----
 if not self.donothing:
 sys.settrace(None)
+ threading.settrace(None)
 
 def runfunc(self, func, *args, **kw):

AltStyle によって変換されたページ (->オリジナル) /