##// END OF EJS Templates
Lots of work on exception handling, including tests for traceback printing....
Lots of work on exception handling, including tests for traceback printing. We finally have some tests for various exception mode printing, via doctests that exercise all three modes! Also changed handling of sys.exit(X) to only print the summary message, as SystemExit is most often a 'handled' exception. It can still be 100% silenced via '%run -e', but now it's much less intrusive. Added a new %tb magic to print the last available traceback with the current xmode. One can then re-print the last traceback with more detail if desired, without having to cause it again.

File last commit:

r2415:21955d0e
r2440:0caaf43a
Show More
tclass.py
30 lines | 803 B | text/x-python | PythonLexer
"""Simple script to be run *twice*, to check reference counting bugs.
See test_run for details."""
import sys
# We want to ensure that while objects remain available for immediate access,
# objects from *previous* runs of the same script get collected, to avoid
# accumulating massive amounts of old references.
class C(object):
def __init__(self,name):
self.name = name
def __del__(self):
print 'tclass.py: deleting object:',self.name
try:
name = sys.argv[1]
except IndexError:
pass
else:
if name.startswith('C'):
c = C(name)
#print >> sys.stderr, "ARGV:", sys.argv # dbg
# This next print statement is NOT debugging, we're making the check on a
# completely separate process so we verify by capturing stdout:
print 'ARGV 1-:', sys.argv[1:]