-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-46964: Move PyInterpreterState.config to _PyRuntimeState.config #31771
base: main
Are you sure you want to change the base?
Changes from all commits
8ea7190
10c0755
bcd9a67
c8e94b6
4daa32e
95fba9d
40a340f
d44c5f3
5193ba5
50afb6d
d664496
81eda9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,7 +552,7 @@ pymain_run_python(int *exitcode) | |
PyObject *main_importer_path = NULL; | ||
PyInterpreterState *interp = _PyInterpreterState_GET(); | ||
/* pymain_run_stdin() modify the config */ | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetGlobalConfig(interp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the cast? |
||
|
||
/* ensure path config is written into global variables */ | ||
if (_PyStatus_EXCEPTION(_PyPathConfig_UpdateGlobal(config))) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -436,7 +436,7 @@ unicode_check_encoding_errors(const char *encoding, const char *errors) | |
PyInterpreterState *interp = _PyInterpreterState_GET(); | ||
#ifndef Py_DEBUG | ||
/* In release mode, only check in development mode (-X dev) */ | ||
if (!_PyInterpreterState_GetConfig(interp)->dev_mode) { | ||
if (!_PyInterpreterState_GetGlobalConfig(interp)->dev_mode) { | ||
return 0; | ||
} | ||
#else | ||
|
@@ -3324,7 +3324,7 @@ PyUnicode_EncodeFSDefault(PyObject *unicode) | |
/* Before _PyUnicode_InitEncodings() is called, the Python codec | ||
machinery is not ready and so cannot be used: | ||
use wcstombs() in this case. */ | ||
const PyConfig *config = _PyInterpreterState_GetConfig(interp); | ||
const PyConfig *config = _PyInterpreterState_GetGlobalConfig(interp); | ||
const wchar_t *filesystem_errors = config->filesystem_errors; | ||
assert(filesystem_errors != NULL); | ||
_Py_error_handler errors = get_error_handler_wide(filesystem_errors); | ||
|
@@ -3562,7 +3562,7 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size) | |
/* Before _PyUnicode_InitEncodings() is called, the Python codec | ||
machinery is not ready and so cannot be used: | ||
use mbstowcs() in this case. */ | ||
const PyConfig *config = _PyInterpreterState_GetConfig(interp); | ||
const PyConfig *config = _PyInterpreterState_GetGlobalConfig(interp); | ||
const wchar_t *filesystem_errors = config->filesystem_errors; | ||
assert(filesystem_errors != NULL); | ||
_Py_error_handler errors = get_error_handler_wide(filesystem_errors); | ||
|
@@ -15026,7 +15026,7 @@ static PyStatus | |
init_stdio_encoding(PyInterpreterState *interp) | ||
{ | ||
/* Update the stdio encoding to the normalized Python codec name. */ | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetGlobalConfig(interp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the cast? |
||
if (config_get_codec_name(&config->stdio_encoding) < 0) { | ||
return _PyStatus_ERR("failed to get the Python codec name " | ||
"of the stdio encoding"); | ||
|
@@ -15038,7 +15038,7 @@ init_stdio_encoding(PyInterpreterState *interp) | |
static int | ||
init_fs_codec(PyInterpreterState *interp) | ||
{ | ||
const PyConfig *config = _PyInterpreterState_GetConfig(interp); | ||
const PyConfig *config = _PyInterpreterState_GetGlobalConfig(interp); | ||
|
||
_Py_error_handler error_handler; | ||
error_handler = get_error_handler_wide(config->filesystem_errors); | ||
|
@@ -15097,7 +15097,7 @@ init_fs_encoding(PyThreadState *tstate) | |
/* Update the filesystem encoding to the normalized Python codec name. | ||
For example, replace "ANSI_X3.4-1968" (locale encoding) with "ascii" | ||
(Python codec name). */ | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); | ||
PyConfig *config = (PyConfig*)_PyInterpreterState_GetGlobalConfig(interp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
if (config_get_codec_name(&config->filesystem_encoding) < 0) { | ||
_Py_DumpPathConfig(tstate); | ||
return _PyStatus_ERR("failed to get the Python codec " | ||
|
@@ -15140,7 +15140,7 @@ int | |
_PyUnicode_EnableLegacyWindowsFSEncoding(void) | ||
{ | ||
PyInterpreterState *interp = _PyInterpreterState_GET(); | ||
PyConfig *config = (PyConfig *)_PyInterpreterState_GetConfig(interp); | ||
PyConfig *config = (PyConfig *)_PyInterpreterState_GetGlobalConfig(interp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
|
||
/* Set the filesystem encoding to mbcs/replace (PEP 529) */ | ||
wchar_t *encoding = _PyMem_RawWcsdup(L"mbcs"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
structs must be at least byte aligned, so this isn't strictly necessary.