FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-92239: Respect PEP 523 by markshannon · Pull Request #92245 · python/cpython · GitHub

/ cpython Public

GH-92239: Respect PEP 523 - #92245

Merged
markshannon merged 4 commits into
python:mainfrom
faster-cpython:fix-92239
May 4, 2022
Merged

GH-92239: Respect PEP 523#92245
markshannon merged 4 commits into
python:mainfrom
faster-cpython:fix-92239

Conversation

Copy link
Copy Markdown
Member

Make sure that we respect PEP 523 when specializing

Copy link
Copy Markdown
Member Author

@itamaro

itamaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm, thanks @markshannon !

Comment thread Python/specialize.c
@@ -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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

will we want to add a check here for overridden vectorcall on func as well, or is it already covered somewhere else? (assuming the vectorcall set API sets the version to zero)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think we want to check for that in #92257

Comment thread Lib/test/test_capi.py Outdated
Comment on lines +1165 to +1170
def test_specialize_before_intercept(self):
def func2():
pass
for _ in range(SUFFICIENT_TO_SPECIALIZE):
func2()
self.do_test(func2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

more for my understanding - this test case fails without the added PEP-523 checks? (but the other one passes?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Both tests should fail without the checks.

Comment thread Python/ceval.c

TARGET(CALL_PY_EXACT_ARGS) {
assert(call_shape.kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Specializations of CALL and PRECALL listed here and here

markshannon merged commit f8a2fab into python:main May 4, 2022
markshannon deleted the fix-92239 branch September 26, 2023 12:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL