diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-29 23:58:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-29 23:58:57 (GMT) |
commit | c9ed9e6fc76323ed537fb79d4232bcd27d82c57e (patch) | |
tree | 32a06498ac936f1d1fded02332c6b5026b59032b /Include | |
parent | 19cd5951ec4480c7cfcbcc379b36902312cfb8b8 (diff) | |
download | cpython-c9ed9e6fc76323ed537fb79d4232bcd27d82c57e.zip cpython-c9ed9e6fc76323ed537fb79d4232bcd27d82c57e.tar.gz cpython-c9ed9e6fc76323ed537fb79d4232bcd27d82c57e.tar.bz2 |
bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)
Fix warnings options priority: PyConfig.warnoptions has the highest
priority, as stated in the PEP 587.
* Document options order in PyConfig.warnoptions documentation.
* Make PyWideStringList_INIT macro private: replace "Py" prefix
with "_Py".
* test_embed: add test_init_warnoptions().
(cherry picked from commit fb4ae152a9930f0e00cae8b2807f534058cf341a)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/initconfig.h | 5 | ||||
-rw-r--r-- | Include/internal/pycore_initconfig.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_pylifecycle.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h index d5effb8..8ce5622 100644 --- a/Include/cpython/initconfig.h +++ b/Include/cpython/initconfig.h @@ -220,7 +220,10 @@ typedef struct { wchar_t *program_name; PyWideStringList xoptions; /* Command line -X options */ - PyWideStringList warnoptions; /* Warnings options */ + + /* Warnings options: lowest to highest priority. warnings.filters + is built in the reverse order (highest to lowest priority). */ + PyWideStringList warnoptions; /* If equal to zero, disable the import of the module site and the site-dependent manipulations of sys.path that it entails. Also disable diff --git a/Include/internal/pycore_initconfig.h b/Include/internal/pycore_initconfig.h index dcdb616..eb6490f 100644 --- a/Include/internal/pycore_initconfig.h +++ b/Include/internal/pycore_initconfig.h @@ -45,7 +45,7 @@ extern "C" { /* --- PyWideStringList ------------------------------------------------ */ -#define PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} +#define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} #ifndef NDEBUG PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list); diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index cb568d2..d4f0ae2 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -41,7 +41,7 @@ extern PyStatus _PySys_Create( PyInterpreterState *interp, PyObject **sysmod_p); extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict); -extern PyStatus _PySys_ReadPreinitWarnOptions(PyConfig *config); +extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); extern int _PySys_InitMain( _PyRuntimeState *runtime, |