From b1a4d4c511c4b3da70b40891cb6e18e0ba6cce9a Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 22:39:19 -0500 Subject: [PATCH 1/2] Add item to C API porting section describing PEP 670 changes --- Doc/whatsnew/3.11.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 56a35f4e4802ba..1f82d9a0bf0edd 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1884,6 +1884,17 @@ New Features Porting to Python 3.11 ---------------------- +* Many macros have been converted to functions in the Python C API, + making them usable from other programming languages and avoiding + `macro pitfalls `_ + The change should be mostly transparent to users, + as the replacement functions will cast their arguments to the expected types + to avoid compiler warnings due to static type checks. + However, when the limited C API is set to >=3.11, these casts are not done, + and callers will need to cast arguments to their expected values. + See :pep:`670` for more details. + (Contributed by Victor Stinner in :gh:`89653`.) + * :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` arguments, the interpreter now derives those values from the exception instance (the ``value`` argument). The function still steals references From 8fad67cb543aa6e4d68ff579bc01d04b41f259a3 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 17 Oct 2022 12:50:29 -0500 Subject: [PATCH 2/2] Apply requested changes from Victor and Kumar to PEP 670 section Co-authored-by: Victor Stinner --- Doc/whatsnew/3.11.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 1f82d9a0bf0edd..55c2645e6b0358 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1884,16 +1884,16 @@ New Features Porting to Python 3.11 ---------------------- -* Many macros have been converted to functions in the Python C API, - making them usable from other programming languages and avoiding - `macro pitfalls `_ +* Some macros have been converted to static inline functions to avoid + `macro pitfalls `_. The change should be mostly transparent to users, as the replacement functions will cast their arguments to the expected types to avoid compiler warnings due to static type checks. - However, when the limited C API is set to >=3.11, these casts are not done, - and callers will need to cast arguments to their expected values. + However, when the limited C API is set to >=3.11, + these casts are not done, + and callers will need to cast arguments to their expected types. See :pep:`670` for more details. - (Contributed by Victor Stinner in :gh:`89653`.) + (Contributed by Victor Stinner and Erlend E. Aasland in :gh:`89653`.) * :c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` arguments, the interpreter now derives those values from the exception pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy