SF #506611, fix sys.setprofile(), sys.settrace() core dumps

when no arguments are passed
This commit is contained in:
Neal Norwitz 2002-03-03 15:12:58 +00:00
parent 54e0eabc2d
commit 290d31e2fc
3 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,7 @@
from __future__ import generators
from test_support import TestFailed
import pprint
import sys
import unittest
@ -329,6 +331,10 @@ protect_ident = ident(protect)
def capture_events(callable, p=None):
try: sys.setprofile()
except TypeError: pass
else: raise TestFailed, 'sys.setprofile() did not raise TypeError'
if p is None:
p = HookWatcher()
sys.setprofile(p.callback)