bpo-34126: Fix crashes while profiling invalid calls. (GH-8300)

This commit is contained in:
jdemeyer 2018-07-21 10:30:59 +02:00 committed by Serhiy Storchaka
parent a692efe473
commit 56868f940e
3 changed files with 28 additions and 4 deletions

View file

@ -334,6 +334,22 @@ class ProfileSimulatorTestCase(TestCaseBase):
(1, 'return', j_ident),
])
# Test an invalid call (bpo-34126)
def test_unbound_method_no_args(self):
def f(p):
dict.get()
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident)])
# Test an invalid call (bpo-34126)
def test_unbound_method_invalid_args(self):
def f(p):
dict.get(print, 42)
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident)])
def ident(function):
if hasattr(function, "f_code"):