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

Merged
merged 3 commits into from
Jan 27, 2025
Merged

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

@cdce8p cdce8p requested a review from JukkaL December 28, 2024 11:14
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@JukkaL JukkaL merged commit 42e005c into python:master Jan 27, 2025
12 checks passed
@cdce8p cdce8p deleted the update-capi-3.8 branch January 27, 2025 12:58
JukkaL pushed a commit that referenced this pull request Jan 27, 2025
Followup to #18341

This PR updates the `capi_version` used for mypyc tests to `3.9` (mypy /
mypyc requires `>=3.9`). For Python 3.9+ mypyc uses
`PyObject_VectorcallMethod` instead of `CPyObject_CallMethodObjArgs` and
select `PyObject_Vectorcall` where ever possible.

Will remove the now unnecessary `use_method_vectorcall` check in a
followup.

https://github.com/python/mypy/blob/42e005c999d8341c0da6d7b93b10d05f2db2099c/mypyc/common.py#L114-L116
JukkaL pushed a commit that referenced this pull request Jan 31, 2025
…orcall (#18548)

Followup to #18341 and #18546

We only support Python 3.9+, so `PyObject_Vectorcall` and
`PyObject_VectorcallMethod` are always available. Remove backwards
compatibility layer.
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
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.

https://github.com/python/mypy/blob/aa0b6f0288e6a511b750f7fe8f49a0e321362105/mypyc/common.py#L103-L105
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
Followup to python#18341

This PR updates the `capi_version` used for mypyc tests to `3.9` (mypy /
mypyc requires `>=3.9`). For Python 3.9+ mypyc uses
`PyObject_VectorcallMethod` instead of `CPyObject_CallMethodObjArgs` and
select `PyObject_Vectorcall` where ever possible.

Will remove the now unnecessary `use_method_vectorcall` check in a
followup.

https://github.com/python/mypy/blob/42e005c999d8341c0da6d7b93b10d05f2db2099c/mypyc/common.py#L114-L116
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
…orcall (python#18548)

Followup to python#18341 and python#18546

We only support Python 3.9+, so `PyObject_Vectorcall` and
`PyObject_VectorcallMethod` are always available. Remove backwards
compatibility layer.
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.

2 participants