From f35f65b04c7a3b5075a66ce072bcf08de5712b3a Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 19 May 2021 15:02:13 +0200 Subject: [PATCH 1/7] bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI --- Doc/data/stable_abi.dat | 1 - Misc/stable_abi.txt | 2 -- PC/python3dll.c | 1 - 3 files changed, 4 deletions(-) diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index d582204f5626b9..50207ac91ec8a8 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -783,7 +783,6 @@ var,Py_FileSystemDefaultEncodeErrors,3.10, var,Py_FileSystemDefaultEncoding,3.2, function,Py_Finalize,3.2, function,Py_FinalizeEx,3.6, -function,Py_FrozenMain,3.10, function,Py_GenericAlias,3.9, function,Py_GenericAliasType,3.9, function,Py_GetBuildInfo,3.2, diff --git a/Misc/stable_abi.txt b/Misc/stable_abi.txt index a78bcb76b41df6..adee1a9fe73035 100644 --- a/Misc/stable_abi.txt +++ b/Misc/stable_abi.txt @@ -2079,8 +2079,6 @@ function PyType_GetModule added 3.10 function PyType_GetModuleState added 3.10 -function Py_FrozenMain - added 3.10 function PyFrame_GetLineNumber added 3.10 function PyFrame_GetCode diff --git a/PC/python3dll.c b/PC/python3dll.c index 200d1d14e294d1..be85f27e72ac81 100755 --- a/PC/python3dll.c +++ b/PC/python3dll.c @@ -55,7 +55,6 @@ EXPORT_FUNC(Py_Exit) EXPORT_FUNC(Py_FatalError) EXPORT_FUNC(Py_Finalize) EXPORT_FUNC(Py_FinalizeEx) -EXPORT_FUNC(Py_FrozenMain) EXPORT_FUNC(Py_GenericAlias) EXPORT_FUNC(Py_GenericAliasType) EXPORT_FUNC(Py_GetArgcArgv) From eb57a3b28cf8805040a4ed5a88488ddb5ec2c82a Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 19 May 2021 15:16:09 +0200 Subject: [PATCH 2/7] Don't define Py_FrozenMain with Py_LIMITED_API --- Include/pylifecycle.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 7925eafc660474..8877a30f553176 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -31,10 +31,13 @@ PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int); /* Bootstrap __main__ (defined in Modules/main.c) */ PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); +PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv); +/* Py_FrozenMain is kept out of the Limited API until documented and present + in all builds of Python */ +#ifndef Py_LIMITED_API PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv); - -PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv); +#endif /* In pathconfig.c */ Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *); From dac5c8c7cdcbeea3729473b4b31773fe7b62785f Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 19 May 2021 15:09:52 +0200 Subject: [PATCH 3/7] Add a blurb --- Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst diff --git a/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst new file mode 100644 index 00000000000000..8e704ea90bccf1 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst @@ -0,0 +1,2 @@ +:c:func`Py_FrozenMain`, is no longer considered part of the Limited API and Stable ABI, +to which it was added in 3.10.0a4 (bpo-23730). From 7aa20ce33e9352cceffebf605d1f47a3e9866554 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 19 May 2021 16:03:46 +0200 Subject: [PATCH 4/7] Fix ReST syntax in blurb --- Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst index 8e704ea90bccf1..f683ad5bf5c55e 100644 --- a/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst +++ b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst @@ -1,2 +1,2 @@ -:c:func`Py_FrozenMain`, is no longer considered part of the Limited API and Stable ABI, +:c:func:`Py_FrozenMain`, is no longer considered part of the Limited API and Stable ABI, to which it was added in 3.10.0a4 (bpo-23730). From 35bcbfb31335b9c6525817c337a7ee041962f86e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 21 May 2021 11:23:59 +0200 Subject: [PATCH 5/7] Move Py_FrozenMain definition ot Include/cpython --- Include/cpython/pylifecycle.h | 4 ++++ Include/pylifecycle.h | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index 6fe46a544016f4..bb5b07ef5901c8 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -2,6 +2,10 @@ # error "this header file must not be included directly" #endif +/* Py_FrozenMain is kept out of the Limited API until documented and present + in all builds of Python */ +PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv); + /* Only used by applications that embed the interpreter and need to * override the standard encoding determination mechanism */ diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 8877a30f553176..9b2dd0868eb25b 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -33,12 +33,6 @@ PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int); PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv); -/* Py_FrozenMain is kept out of the Limited API until documented and present - in all builds of Python */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv); -#endif - /* In pathconfig.c */ Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *); PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); From 860fdd09ba282ccb87adbc8d9440de17ef66af00 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 21 May 2021 13:14:23 +0200 Subject: [PATCH 6/7] Update news & whatsnew --- Doc/whatsnew/3.10.rst | 5 +++++ .../next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 570af7f3b61814..4db426167f374a 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -1919,6 +1919,11 @@ Porting to Python 3.10 instead. (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.) +* The undocumented function ``Py_FrozenMain`` has been removed from the + limited API. The function is mainly useful for custom builds of Python, + and it is not always present when Python is built as a shared library. + (Contributed by Petr Viktorin in :issue:`26241`) + Deprecated ---------- diff --git a/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst index f683ad5bf5c55e..23db2330ac3960 100644 --- a/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst +++ b/Misc/NEWS.d/next/C API/2021-05-19-15-09-47.bpo-43795.WAHRxt.rst @@ -1,2 +1 @@ -:c:func:`Py_FrozenMain`, is no longer considered part of the Limited API and Stable ABI, -to which it was added in 3.10.0a4 (bpo-23730). +The undocumented function :c:func:`Py_FrozenMain` is removed from the Limited API. From b333913e7f83f61a49028f5cc6606948f3322963 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 25 May 2021 13:19:05 +0200 Subject: [PATCH 7/7] Update Doc/whatsnew/3.10.rst --- Doc/whatsnew/3.10.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 4db426167f374a..4fee64369329f8 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -1920,8 +1920,7 @@ Porting to Python 3.10 (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.) * The undocumented function ``Py_FrozenMain`` has been removed from the - limited API. The function is mainly useful for custom builds of Python, - and it is not always present when Python is built as a shared library. + limited API. The function is mainly useful for custom builds of Python. (Contributed by Petr Viktorin in :issue:`26241`) Deprecated