summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-04 12:39:15 (GMT)
committerGitHub <noreply@github.com>2017-12-04 12:39:15 (GMT)
commit31a8393cf6a74c870c3484dd68500619f6232c6d (patch)
tree11a7d0b4f4df344e1dbe9798a7d48ca2acc8abae /Include
parent70d56fb52582d9d3f7c00860d6e90570c6259371 (diff)
downloadcpython-31a8393cf6a74c870c3484dd68500619f6232c6d.zip
cpython-31a8393cf6a74c870c3484dd68500619f6232c6d.tar.gz
cpython-31a8393cf6a74c870c3484dd68500619f6232c6d.tar.bz2
Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)" (#4694)
* Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)" This reverts commit 13badcbc60cdbfae1dba1683fd2fae9d70717143. Re-apply commits: * "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)" commit af5a895073c24637c094772b27526b94a12ec897. * "bpo-32030: Fix config_get_program_name() on macOS (#4669)" commit e23c06e2b03452c9aaf0dae52296c85e572f9bcd. * "bpo-32030: Add Python/pathconfig.c (#4668)" commit 0ea395ae964c9cd0f499e2ef0d0030c971201220. * "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)" commit ebac19dad6263141d5db0a2c923efe049dba99d2. * "bpo-32030: Fix Py_GetPath(): init program_name (#4665)" commit 9ac3d8882712c9675c3d2f9f84af6b5729575cde. * Fix compilation error on macOS
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pystate.h29
-rw-r--r--Include/pylifecycle.h3
-rw-r--r--Include/pystate.h3
3 files changed, 31 insertions, 4 deletions
diff --git a/Include/internal/pystate.h b/Include/internal/pystate.h
index 50ad2fc..b933421 100644
--- a/Include/internal/pystate.h
+++ b/Include/internal/pystate.h
@@ -48,9 +48,36 @@ typedef struct {
#endif
/* Set by Py_SetPath(), or computed by _PyPathConfig_Init() */
wchar_t *module_search_path;
+ /* Python program name */
+ wchar_t *program_name;
+ /* Set by Py_SetPythonHome() or PYTHONHOME environment variable */
+ wchar_t *home;
} _PyPathConfig;
-#define _PyPathConfig_INIT {.module_search_path = NULL}
+#ifdef MS_WINDOWS
+#define _PyPathConfig_INIT \
+ {.program_full_path = NULL, \
+ .prefix = NULL, \
+ .dll_path = NULL, \
+ .module_search_path = NULL, \
+ .program_name = NULL, \
+ .home = NULL}
+#else
+#define _PyPathConfig_INIT \
+ {.program_full_path = NULL, \
+ .prefix = NULL, \
+ .exec_prefix = NULL, \
+ .module_search_path = NULL, \
+ .program_name = NULL, \
+ .home = NULL}
+#endif
+
+PyAPI_DATA(_PyPathConfig) _Py_path_config;
+
+PyAPI_FUNC(_PyInitError) _PyPathConfig_Calculate(
+ _PyPathConfig *config,
+ const _PyMainInterpreterConfig *main_config);
+PyAPI_FUNC(void) _PyPathConfig_Clear(_PyPathConfig *config);
/* Full Python runtime state */
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
index d32c98b..fa75169 100644
--- a/Include/pylifecycle.h
+++ b/Include/pylifecycle.h
@@ -105,11 +105,10 @@ PyAPI_FUNC(wchar_t *) Py_GetPath(void);
#ifdef Py_BUILD_CORE
PyAPI_FUNC(_PyInitError) _PyPathConfig_Init(
const _PyMainInterpreterConfig *main_config);
-PyAPI_FUNC(void) _PyPathConfig_Fini(void);
#endif
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
#ifdef MS_WINDOWS
-int _Py_CheckPython3();
+int _Py_CheckPython3(void);
#endif
/* In their own files */
diff --git a/Include/pystate.h b/Include/pystate.h
index 60d001c..1d8aab6 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -72,7 +72,8 @@ typedef struct {
(_PyMainInterpreterConfig){\
.install_signal_handlers = -1, \
.module_search_path_env = NULL, \
- .home = NULL}
+ .home = NULL, \
+ .program_name = NULL}
typedef struct _is {