diff options
author | Victor Stinner <vstinner@python.org> | 2022-06-17 14:12:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 14:12:00 (GMT) |
commit | 0ff626f210c69643d0d5afad1e6ec6511272b3ce (patch) | |
tree | cc6b273fa241aeaccbcfa1ecff5bb6793f746e84 /Python/initconfig.c | |
parent | f64557f4803528c53bb9a1d565e3cdf92e97152f (diff) | |
download | cpython-0ff626f210c69643d0d5afad1e6ec6511272b3ce.zip cpython-0ff626f210c69643d0d5afad1e6ec6511272b3ce.tar.gz cpython-0ff626f210c69643d0d5afad1e6ec6511272b3ce.tar.bz2 |
gh-77782: Deprecate global configuration variable (#93943)
Deprecate global configuration variable like
Py_IgnoreEnvironmentFlag: the Py_InitializeFromConfig() API should be
instead.
Fix declaration of Py_GETENV(): use PyAPI_FUNC(), not PyAPI_DATA().
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index e5b8787..62f1f67 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -201,6 +201,8 @@ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */ static PyObject * _Py_GetGlobalVariablesAsDict(void) { +_Py_COMP_DIAG_PUSH +_Py_COMP_DIAG_IGNORE_DEPR_DECLS PyObject *dict, *obj; dict = PyDict_New(); @@ -267,15 +269,19 @@ fail: #undef SET_ITEM #undef SET_ITEM_INT #undef SET_ITEM_STR +_Py_COMP_DIAG_POP } char* Py_GETENV(const char *name) { +_Py_COMP_DIAG_PUSH +_Py_COMP_DIAG_IGNORE_DEPR_DECLS if (Py_IgnoreEnvironmentFlag) { return NULL; } return getenv(name); +_Py_COMP_DIAG_POP } /* --- PyStatus ----------------------------------------------- */ @@ -1443,6 +1449,8 @@ config_get_env_dup(PyConfig *config, static void config_get_global_vars(PyConfig *config) { +_Py_COMP_DIAG_PUSH +_Py_COMP_DIAG_IGNORE_DEPR_DECLS if (config->_config_init != _PyConfig_INIT_COMPAT) { /* Python and Isolated configuration ignore global variables */ return; @@ -1478,6 +1486,7 @@ config_get_global_vars(PyConfig *config) #undef COPY_FLAG #undef COPY_NOT_FLAG +_Py_COMP_DIAG_POP } @@ -1485,6 +1494,8 @@ config_get_global_vars(PyConfig *config) static void config_set_global_vars(const PyConfig *config) { +_Py_COMP_DIAG_PUSH +_Py_COMP_DIAG_IGNORE_DEPR_DECLS #define COPY_FLAG(ATTR, VAR) \ if (config->ATTR != -1) { \ VAR = config->ATTR; \ @@ -1519,6 +1530,7 @@ config_set_global_vars(const PyConfig *config) #undef COPY_FLAG #undef COPY_NOT_FLAG +_Py_COMP_DIAG_POP } |