bpo-34125: Enable profiling of method_descriptor in all cases (GH-8416)

`list.append([], None)` was profiled but `list.append([], None, **{})` was not profiled.
Enable profiling for later case.

https://bugs.python.org/issue34125
This commit is contained in:
jdemeyer 2018-09-19 12:06:20 +02:00 committed by Miss Islington (bot)
parent b3b8cb419e
commit e89de73987
3 changed files with 46 additions and 3 deletions

View file

@ -350,6 +350,24 @@ class ProfileSimulatorTestCase(TestCaseBase):
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident)])
# Test an invalid call (bpo-34125)
def test_unbound_method_no_args(self):
kwargs = {}
def f(p):
dict.get(**kwargs)
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident)])
# Test an invalid call (bpo-34125)
def test_unbound_method_invalid_args(self):
kwargs = {}
def f(p):
dict.get(print, 42, **kwargs)
f_ident = ident(f)
self.check_events(f, [(1, 'call', f_ident),
(1, 'return', f_ident)])
def ident(function):
if hasattr(function, "f_code"):