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

gh-104922: Make PY_SSIZE_T_CLEAN not mandatory #104923

Closed
wants to merge 8 commits into from

Conversation

methane
Copy link
Member

@methane methane commented May 25, 2023

This PR keeps ABIs like PyArg_Parse() raise SystemError.

At API level, PyArg_Parse is always replaced to _PyArg_Parse_Size_T by C macro regardless PY_SSIZE_T_CLEAN .


📚 Documentation preview 📚: https://cpython-previews--104923.org.readthedocs.build/

@methane methane added topic-C-API 3.13 bugs and security fixes labels May 25, 2023
@methane methane force-pushed the arg-ssize_t-by-default branch 5 times, most recently from f1b028c to f1141a1 Compare May 25, 2023 13:13
#ifdef PY_SSIZE_T_CLEAN
# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
#endif

Copy link
Member Author

@methane methane May 25, 2023

Choose a reason for hiding this comment

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

These are not a part of stable ABI.
_PyObject_CallMethodId_SizeT is removed and _PyObject_CallMethodId is ssize_t version.

PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT(
PyObject **small_stack,
Py_ssize_t small_stack_len,
const char *format,
va_list va,
Py_ssize_t *p_nargs);
#endif
Copy link
Member Author

@methane methane May 25, 2023

Choose a reason for hiding this comment

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

Both of _Py_VaBuildStack and _Py_VaBuildStack_SizeT are remained, without macro alias.

@@ -211,7 +211,7 @@ sys_audit_tstate(PyThreadState *ts, const char *event,

/* Initialize event args now */
if (argFormat && argFormat[0]) {
eventArgs = _Py_VaBuildValue_SizeT(argFormat, vargs);
eventArgs = Py_VaBuildValue(argFormat, vargs);
Copy link
Member Author

Choose a reason for hiding this comment

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

sysmodule.c doesn't define PY_SSIZE_T_CLEAN, but Py_VaBuildValue is now alias to _Py_VaBuildValue_SizeT.

@methane methane marked this pull request as ready for review May 25, 2023 14:29
@methane methane requested a review from markshannon as a code owner May 25, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes topic-C-API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants