mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
[3.12] gh-116626: Emit CALL
events for all `INSTRUMENTED_CALL_FUNCTION_EX (GH-116732)
Backport of GH-116627
This commit is contained in:
parent
fc4d5fdffe
commit
56a3c5f767
4 changed files with 44 additions and 28 deletions
|
@ -1743,3 +1743,18 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase):
|
|||
sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0)
|
||||
sys.monitoring.set_events(0, E.LINE | E.INSTRUCTION)
|
||||
sys.monitoring.set_events(0, 0)
|
||||
|
||||
def test_call_function_ex(self):
|
||||
def f(a, b):
|
||||
return a + b
|
||||
args = (1, 2)
|
||||
|
||||
call_data = []
|
||||
sys.monitoring.use_tool_id(0, "test")
|
||||
self.addCleanup(sys.monitoring.free_tool_id, 0)
|
||||
sys.monitoring.set_events(0, 0)
|
||||
sys.monitoring.register_callback(0, E.CALL, lambda code, offset, callable, arg0: call_data.append((callable, arg0)))
|
||||
sys.monitoring.set_events(0, E.CALL)
|
||||
f(*args)
|
||||
sys.monitoring.set_events(0, 0)
|
||||
self.assertEqual(call_data[0], (f, 1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue