Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
gh-146175: Soft-deprecate outdated macros; convert internal usage#146178
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
17da7d8 gh-146175: Soft-deprecate outdated macros; convert internal usage
encukoua31db85 Avoid clang's "that's a GNU extension!" warning for `#ifdef __GNUC__`
encukoue3ea0ba Merge in the main branch
encukoua9d1708 Move the tests to a function
encukoue22a793 Modules/_testcapimodule.c: PEP 7
encukou6aa2cae Merge branch 'main' into helper-macros
encukou8caf942 Convert recently added cases of Py_ALIGNED
encukouFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -526,14 +526,26 @@ to the C language. | ||
| Outdated macros | ||
| --------------- | ||
| The following:term:`soft deprecated`macros have been used to features that | ||
| have been standardizedin C11 (or previous standards). | ||
| .. c:macro:: Py_ALIGNED(num) | ||
| On some GCC-like compilers, specify alignment to *num* bytes. | ||
| This does nothing on other compilers. | ||
| Use the standard ``alignas`` specifier rather than this macro. | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: PY_FORMAT_SIZE_T | ||
| The :c:func:`printf` formatting modifier for :c:type:`size_t`. | ||
| Use ``"z"`` directly instead. | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: Py_LL(number) | ||
| Py_ULL(number) | ||
| @@ -546,6 +558,38 @@ in C11. | ||
| Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly. | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: PY_LONG_LONG | ||
| PY_INT32_T | ||
| PY_UINT32_T | ||
| PY_INT64_T | ||
| PY_UINT64_T | ||
| Aliases for the types :c:type:`!long long`, :c:type:`!int32_t`, | ||
| :c:type:`!uint32_t`. :c:type:`!int64_t` and :c:type:`!uint64_t`, | ||
| respectively. | ||
| Historically, these types needed compiler-specific extensions. | ||
| .. deprecated:: next | ||
| These macros are :term:`soft deprecated`. | ||
| .. c:macro:: PY_LLONG_MIN | ||
| PY_LLONG_MAX | ||
| PY_ULLONG_MAX | ||
| PY_SIZE_MAX | ||
| Aliases for the values :c:macro:`!LLONG_MIN`, :c:macro:`!LLONG_MAX`, | ||
| :c:macro:`!ULLONG_MAX`, and :c:macro:`!SIZE_MAX`, respectively. | ||
| Use these standard names instead. | ||
| The required header, ``<limits.h>``, | ||
| :ref:`is included <capi-system-includes>` in ``Python.h``. | ||
| .. deprecated:: next | ||
| These macros are :term:`soft deprecated`. | ||
| .. c:macro:: Py_MEMCPY(dest, src, n) | ||
| This is a :term:`soft deprecated` alias to :c:func:`!memcpy`. | ||
| @@ -554,6 +598,25 @@ in C11. | ||
| .. deprecated:: 3.14 | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: Py_UNICODE_SIZE | ||
| Size of the :c:type:`!wchar_t` type. | ||
| Use ``sizeof(wchar_t)`` or ``WCHAR_WIDTH/8`` instead. | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| The required header for the latter, ``<limits.h>``, | ||
| :ref:`is included <capi-system-includes>` in ``Python.h``. | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: Py_UNICODE_WIDE | ||
| Defined if ``wchar_t`` can hold a Unicode character (UCS-4). | ||
| Use ``sizeof(wchar_t) >= 4`` instead | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. c:macro:: Py_VA_COPY | ||
| This is a :term:`soft deprecated` alias to the C99-standard ``va_copy`` | ||
| @@ -564,6 +627,9 @@ in C11. | ||
| .. versionchanged:: 3.6 | ||
| This is now an alias to ``va_copy``. | ||
| .. deprecated:: next | ||
| The macro is :term:`soft deprecated`. | ||
| .. _api-objects: | ||
2 changes: 0 additions & 2 deletionsDoc/deprecations/c-api-pending-removal-in-3.15.rst
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
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
2 changes: 1 addition & 1 deletionInclude/internal/pycore_object.h
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
2 changes: 1 addition & 1 deletionInclude/object.h
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
4 changes: 3 additions & 1 deletionInclude/pyport.h
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
8 changes: 4 additions & 4 deletionsInclude/refcount.h
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
8 changes: 2 additions & 6 deletionsInclude/unicodeobject.h
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
12 changes: 12 additions & 0 deletionsMisc/NEWS.d/next/C_API/2026-03-19-16-50-27.gh-issue-146175.pISQGX.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| The following macros are :term:`soft deprecated`: | ||
| :c:macro:`Py_ALIGNED`, | ||
| :c:macro:`PY_FORMAT_SIZE_T`, | ||
| :c:macro:`Py_LL`, :c:macro:`Py_ULL`, | ||
| :c:macro:`PY_LONG_LONG`, :c:macro:`PY_LLONG_MIN`, :c:macro:`PY_LLONG_MAX`, | ||
| :c:macro:`PY_ULLONG_MAX`, :c:macro:`PY_INT32_T`, :c:macro:`PY_UINT32_T`, | ||
| :c:macro:`PY_INT64_T`, :c:macro:`PY_UINT64_T`, :c:macro:`PY_SIZE_MAX`, | ||
| :c:macro:`Py_UNICODE_SIZE`, | ||
| :c:macro:`Py_VA_COPY`. | ||
| The macro :c:macro:`Py_UNICODE_WIDE`, which was scheduled for removal, is | ||
| :term:`soft deprecated` instead. |
2 changes: 1 addition & 1 deletionModules/_io/stringio.c
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
36 changes: 36 additions & 0 deletionsModules/_testcapimodule.c
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
4 changes: 1 addition & 3 deletionsModules/arraymodule.c
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
16 changes: 8 additions & 8 deletionsModules/binascii.c
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
2 changes: 1 addition & 1 deletionModules/socketmodule.c
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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.