[Python-checkins] CVS: python/dist/src/Lib unittest.py,1.12,1.13

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月06日 19:39:36 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv24969
Modified Files:
	unittest.py 
Log Message:
In unconditional except clauses, don't catch KeyboardInterrupt -- it's
annoying that often you have to hit ^C numerous times before it
works. The solution: before the "except:" clause, insert "except
KeyboardInterrupt: raise". This propagates KeyboardInterrupt out,
stopping the test in its tracks.
Index: unittest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** unittest.py	2001年10月22日 18:14:15	1.12
--- unittest.py	2001年12月07日 03:39:34	1.13
***************
*** 203,206 ****
--- 203,208 ----
 try:
 self.setUp()
+ except KeyboardInterrupt:
+ raise
 except:
 result.addError(self, self.__exc_info())
***************
*** 213,216 ****
--- 215,220 ----
 except self.failureException, e:
 result.addFailure(self, self.__exc_info())
+ except KeyboardInterrupt:
+ raise
 except:
 result.addError(self, self.__exc_info())
***************
*** 218,221 ****
--- 222,227 ----
 try:
 self.tearDown()
+ except KeyboardInterrupt:
+ raise
 except:
 result.addError(self, self.__exc_info())

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