Message330015
Passing the memory allocator is my first goal.
My second goal is to cleanup the code reading the configuration, pymain_read_conf() in Modules/main.c:
int utf8_mode = config->ctx.utf8_mode;
int encoding_changed = 0;
(...)
/* bpo-34207: Py_DecodeLocale() and Py_EncodeLocale() depend
on Py_UTF8Mode and Py_LegacyWindowsFSEncodingFlag. */
Py_UTF8Mode = config->ctx.utf8_mode;
#ifdef MS_WINDOWS
Py_LegacyWindowsFSEncodingFlag = config->legacy_windows_fs_encoding;
#endif
(...)
/* Reset the configuration before reading again the configuration,
just keep UTF-8 Mode value. */
int new_utf8_mode = config->ctx.utf8_mode;
int new_coerce_c_locale = config->coerce_c_locale;
if (_PyCoreConfig_Copy(config, &save_config) < 0) {
pymain->err = _Py_INIT_NO_MEMORY();
goto done;
}
pymain_clear_cmdline(pymain, cmdline);
config->ctx.utf8_mode = new_utf8_mode;
config->coerce_c_locale = new_coerce_c_locale;
/* The encoding changed: read again the configuration
with the new encoding */
My main concern is: "bpo-34207: Py_DecodeLocale() and Py_EncodeLocale() depend on Py_UTF8Mode and Py_LegacyWindowsFSEncodingFlag". Python initialization code should depend on global variables. |
|
Date |
User |
Action |
Args |
2018-11-17 00:24:03 | vstinner | set | recipients:
+ vstinner, ncoghlan, eric.snow |
2018-11-17 00:24:03 | vstinner | set | messageid: <1542414243.3.0.788709270274.issue35265@psf.upfronthosting.co.za> |
2018-11-17 00:24:03 | vstinner | link | issue35265 messages |
2018-11-17 00:24:03 | vstinner | create | |
|