summaryrefslogtreecommitdiffstats
path: root/Python/initconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r--Python/initconfig.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index b706f4c..87dea5e 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -2069,6 +2069,7 @@ config_init_warnoptions(PyConfig *config,
/* The priority order for warnings configuration is (highest precedence
* first):
*
+ * - early PySys_AddWarnOption() calls
* - the BytesWarning filter, if needed ('-b', '-bb')
* - any '-W' command line options; then
* - the 'PYTHONWARNINGS' environment variable; then
@@ -2124,6 +2125,13 @@ config_init_warnoptions(PyConfig *config,
return status;
}
}
+
+ /* Handle early PySys_AddWarnOption() calls */
+ status = _PySys_ReadPreinitWarnOptions(config);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+
return _PyStatus_OK();
}
@@ -2293,7 +2301,8 @@ config_read_cmdline(PyConfig *config)
}
status = config_init_warnoptions(config,
- &cmdline_warnoptions, &env_warnoptions);
+ &cmdline_warnoptions,
+ &env_warnoptions);
if (_PyStatus_EXCEPTION(status)) {
goto done;
}
@@ -2403,6 +2412,12 @@ PyConfig_Read(PyConfig *config)
goto done;
}
+ /* Handle early PySys_AddXOption() calls */
+ status = _PySys_ReadPreinitXOptions(config);
+ if (_PyStatus_EXCEPTION(status)) {
+ goto done;
+ }
+
status = config_read(config);
if (_PyStatus_EXCEPTION(status)) {
goto done;