Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions 18 Lib/test/test_sys_setprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,24 @@ class A:
# The last c_call is the call to sys.setprofile
self.assertEqual(events, ['c_call', 'c_return', 'c_call'])

class B:
f = classmethod(max)
events = []
sys.setprofile(lambda frame, event, args: events.append(event))
# Not important, we only want to trigger INSTRUMENTED_CALL_KW
B().f(1, key=lambda x: 0)
sys.setprofile(None)
# The last c_call is the call to sys.setprofile
self.assertEqual(
events,
['c_call',
'call', 'return',
'call', 'return',
'c_return',
'c_call'
]
)


if __name__ == "__main__":
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``INSTRUMENTED_CALL_KW`` will expand the method before monitoring to reflect the actual behavior more accurately.
2 changes: 1 addition & 1 deletion 2 Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4509,8 +4509,8 @@ dummy_func(
macro(INSTRUMENTED_CALL_KW) =
counter/1 +
unused/2 +
_MONITOR_CALL_KW +
_MAYBE_EXPAND_METHOD_KW +
_MONITOR_CALL_KW +
_DO_CALL_KW;

op(_CHECK_IS_NOT_PY_CALLABLE_KW, (callable[1], unused[1], unused[oparg], kwnames -- callable[1], unused[1], unused[oparg], kwnames)) {
Expand Down
52 changes: 25 additions & 27 deletions 52 Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.