Skip to content

Commit 13badcb

Browse files
bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)
* Revert "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)" This reverts commit af5a895. * Revert "bpo-32030: Fix config_get_program_name() on macOS (#4669)" This reverts commit e23c06e. * Revert "bpo-32030: Add Python/pathconfig.c (#4668)" This reverts commit 0ea395a. * Revert "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)" This reverts commit ebac19d. * Revert "bpo-32030: Fix Py_GetPath(): init program_name (#4665)" This reverts commit 9ac3d88.
1 parent af5a895 commit 13badcb

File tree

12 files changed

+424
-455
lines changed

12 files changed

+424
-455
lines changed

Doc/c-api/init.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The following functions can be safely called before Python is initialized:
4040
* :c:func:`Py_GetCompiler`
4141
* :c:func:`Py_GetCopyright`
4242
* :c:func:`Py_GetPlatform`
43+
* :c:func:`Py_GetProgramName`
4344
* :c:func:`Py_GetVersion`
4445

4546
* Utilities:
@@ -58,8 +59,8 @@ The following functions can be safely called before Python is initialized:
5859
The following functions **should not be called** before
5960
:c:func:`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`,
6061
:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
61-
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`,
62-
:c:func:`Py_GetProgramName` and :c:func:`PyEval_InitThreads`.
62+
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
63+
:c:func:`PyEval_InitThreads`.
6364

6465

6566
.. _global-conf-vars:

Include/internal/pystate.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,9 @@ typedef struct {
4848
#endif
4949
/* Set by Py_SetPath(), or computed by _PyPathConfig_Init() */
5050
wchar_t *module_search_path;
51-
/* Python program name */
52-
wchar_t *program_name;
53-
/* Set by Py_SetPythonHome() or PYTHONHOME environment variable */
54-
wchar_t *home;
5551
} _PyPathConfig;
5652

57-
#ifdef MS_WINDOWS
58-
#define _PyPathConfig_INIT \
59-
{.program_full_path = NULL, \
60-
.prefix = NULL, \
61-
.dll_path = NULL, \
62-
.module_search_path = NULL, \
63-
.program_name = NULL, \
64-
.home = NULL}
65-
#else
66-
#define _PyPathConfig_INIT \
67-
{.program_full_path = NULL, \
68-
.prefix = NULL, \
69-
.exec_prefix = NULL, \
70-
.module_search_path = NULL, \
71-
.program_name = NULL, \
72-
.home = NULL}
73-
#endif
74-
75-
PyAPI_DATA(_PyPathConfig) _Py_path_config;
76-
77-
PyAPI_FUNC(_PyInitError) _PyPathConfig_Calculate(
78-
_PyPathConfig *config,
79-
const _PyMainInterpreterConfig *main_config);
80-
PyAPI_FUNC(void) _PyPathConfig_Clear(_PyPathConfig *config);
53+
#define _PyPathConfig_INIT {.module_search_path = NULL}
8154

8255

8356
/* Full Python runtime state */

Include/pylifecycle.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ PyAPI_FUNC(wchar_t *) Py_GetPath(void);
105105
#ifdef Py_BUILD_CORE
106106
PyAPI_FUNC(_PyInitError) _PyPathConfig_Init(
107107
const _PyMainInterpreterConfig *main_config);
108+
PyAPI_FUNC(void) _PyPathConfig_Fini(void);
108109
#endif
109110
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
110111
#ifdef MS_WINDOWS
111-
int _Py_CheckPython3(void);
112+
int _Py_CheckPython3();
112113
#endif
113114

114115
/* In their own files */

Include/pystate.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ typedef struct {
7272
(_PyMainInterpreterConfig){\
7373
.install_signal_handlers = -1, \
7474
.module_search_path_env = NULL, \
75-
.home = NULL, \
76-
.program_name = NULL}
75+
.home = NULL}
7776

7877
typedef struct _is {
7978

Makefile.pre.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,8 @@ PYTHON_OBJS= \
337337
Python/importdl.o \
338338
Python/marshal.o \
339339
Python/modsupport.o \
340-
Python/mysnprintf.o \
341340
Python/mystrtoul.o \
342-
Python/pathconfig.o \
341+
Python/mysnprintf.o \
343342
Python/peephole.o \
344343
Python/pyarena.o \
345344
Python/pyctype.o \

0 commit comments

Comments
 (0)