mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF #506611, fix sys.setprofile(), sys.settrace() core dumps
when no arguments are passed
This commit is contained in:
parent
54e0eabc2d
commit
290d31e2fc
3 changed files with 12 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue