Skip to content
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

Update capi_version for mypyc tests to 3.8 #18341

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Dec 25, 2024

This PR updates the capi_version used for mypyc tests to 3.8 (mypy / mypyc requires >=3.9). Test data updates done with --update-data. For Python 3.8+ mypyc uses _PyObject_Vectorcall instead of PyObject_CallFunctionObjArgs and PyObject_Call where ever possible.

Will remove the now unnecessary use_vectorcall check in a followup.

mypy/mypyc/common.py

Lines 103 to 105 in aa0b6f0

def use_vectorcall(capi_version: tuple[int, int]) -> bool:
# We can use vectorcalls to make calls on Python 3.8+ (PEP 590).
return capi_version >= (3, 8)

@cdce8p cdce8p added the topic-mypyc mypyc bugs label Dec 25, 2024
c_function_name="_PyObject_Vectorcall",
c_function_name="PyObject_Vectorcall",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PyObject_Vectorcall is available unconditionally from pythoncapi_compat.h. Included the underscore removal here so I wouldn't have to do another big PR just for that.

// gh-105922 added PyObject_Vectorcall() to Python 3.9.0a4
#if PY_VERSION_HEX < 0x030900A4
static inline PyObject*
PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{
#if PY_VERSION_HEX >= 0x030800B1 && !defined(PYPY_VERSION)
// bpo-36974 added _PyObject_Vectorcall() to Python 3.8.0b1
return _PyObject_Vectorcall(callable, args, nargsf, kwnames);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-mypyc mypyc bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant