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
4 changes: 2 additions & 2 deletions 4 Include/internal/pycore_opcode_metadata.h

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

4 changes: 2 additions & 2 deletions 4 Include/internal/pycore_uop_ids.h

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

16 changes: 8 additions & 8 deletions 16 Include/internal/pycore_uop_metadata.h

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

3 changes: 3 additions & 0 deletions 3 Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2780,9 +2780,12 @@ def testfunc(n):
self.assertEqual(res, TIER2_THRESHOLD * 5)
self.assertIsNotNone(ex)
uops = get_opnames(ex)

self.assertIn("_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE", uops)
self.assertNotIn("_CALL_METHOD_DESCRIPTOR_NOARGS", uops)
self.assertNotIn("_GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS", uops)
self.assertGreaterEqual(count_ops(ex, "_POP_TOP"), 5)
self.assertGreaterEqual(count_ops(ex, "_POP_TOP"), 3)

def test_call_method_descriptor_fast(self):
def testfunc(n):
Expand Down
34 changes: 24 additions & 10 deletions 34 Modules/_testinternalcapi/test_cases.c.h

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

27 changes: 16 additions & 11 deletions 27 Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4948,7 +4948,7 @@ dummy_func(
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
}

op(_CALL_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- res, c, s)) {
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;

Expand All @@ -4963,15 +4963,16 @@ dummy_func(
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc, self, NULL);
_Py_LeaveRecursiveCallTstate(tstate);
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
PyStackRef_CLOSE(self_stackref);
DEAD(args);
DEAD(self_or_null);
PyStackRef_CLOSE(callable);
ERROR_IF(res_o == NULL);
if (res_o == NULL) {
ERROR_NO_POP();
}
c = callable;
s = args[0];
INPUTS_DEAD();
res = PyStackRef_FromPyObjectSteal(res_o);
}

tier2 op(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
tier2 op(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, (callable, args[oparg], cfunc/4 -- res, c, s)) {
assert(oparg == 1);
_PyStackRef self_stackref = args[0];
PyObject *self = PyStackRef_AsPyObjectBorrow(self_stackref);
Expand All @@ -4980,10 +4981,12 @@ dummy_func(
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc_v, self, NULL);
_Py_LeaveRecursiveCallTstate(tstate);
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
PyStackRef_CLOSE(self_stackref);
DEAD(args);
PyStackRef_CLOSE(callable);
ERROR_IF(res_o == NULL);
if (res_o == NULL) {
ERROR_NO_POP();
}
c = callable;
s = args[0];
INPUTS_DEAD();

@Sacul0457 Sacul0457 Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we're allowed to use INPUTS_DEAD here because we previously did not call DEAD for cfunc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cfunc is an inline cache entry, so it doesn't need to be called dead.

res = PyStackRef_FromPyObjectSteal(res_o);
}

Expand All @@ -4994,6 +4997,8 @@ dummy_func(
_GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS +
_CHECK_RECURSION_LIMIT +
_CALL_METHOD_DESCRIPTOR_NOARGS +
POP_TOP +
POP_TOP +
_CHECK_PERIODIC_AT_END;

op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
Expand Down
44 changes: 20 additions & 24 deletions 44 Python/executor_cases.c.h

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

34 changes: 24 additions & 10 deletions 34 Python/generated_cases.c.h

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

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