-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
GH-92239: Respect PEP 523 #92245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-92239: Respect PEP 523 #92245
Changes from all commits
c6e875f
4fac45c
71505f9
42ae714
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Make sure that PEP 523 is respected in all cases. In 3.11a7, specialization | ||
| may have prevented Python-to-Python calls respecting PEP 523. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -435,6 +435,7 @@ initial_counter_value(void) { | |
| #define SPEC_FAIL_CALL_METHOD_WRAPPER 26 | ||
| #define SPEC_FAIL_CALL_OPERATOR_WRAPPER 27 | ||
| #define SPEC_FAIL_CALL_PYFUNCTION 28 | ||
| #define SPEC_FAIL_CALL_PEP_523 29 | ||
|
|
||
| /* COMPARE_OP */ | ||
| #define SPEC_FAIL_COMPARE_OP_DIFFERENT_TYPES 12 | ||
|
|
@@ -1466,6 +1467,11 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, | |
| assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE); | ||
| PyCodeObject *code = (PyCodeObject *)func->func_code; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will we want to add a check here for overridden
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to check for that in #92257 |
||
| int kind = function_kind(code); | ||
| /* Don't specialize if PEP 523 is active */ | ||
| if (_PyInterpreterState_GET()->eval_frame) { | ||
| SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523); | ||
| return -1; | ||
| } | ||
| if (kwnames) { | ||
| SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES); | ||
| return -1; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to verify that these opcodes (
CALL_PY_EXACT_ARGS&CALL_PY_WITH_DEFAULTS) are the only ones where this check is needed - I trust you :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specializations of
8000CALLandPRECALLlisted here and here