bpo-46964: Move PyInterpreterState.config to _PyRuntimeState.config#31771
Draft
ericsnowcurrently wants to merge 12 commits intopython:mainfrom
Draft
bpo-46964: Move PyInterpreterState.config to _PyRuntimeState.config#31771ericsnowcurrently wants to merge 12 commits intopython:mainfrom
ericsnowcurrently wants to merge 12 commits intopython:mainfrom
Conversation
arhadthedev
reviewed
Mar 8, 2022
arhadthedev
reviewed
Mar 8, 2022
3f29756 to
81eda9b
Compare
markshannon
reviewed
Oct 7, 2022
| /* Allow the creation of threads. */ | ||
| unsigned int allow_threading:1; | ||
| /* Padding to ensure byte alignment. */ | ||
| unsigned int :5; |
Member
There was a problem hiding this comment.
structs must be at least byte aligned, so this isn't strictly necessary.
| PyInterpreterState *interp = _PyInterpreterState_GET(); | ||
| /* pymain_run_stdin() modify the config */ | ||
| PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); | ||
| PyConfig *config = (PyConfig*)_PyInterpreterState_GetGlobalConfig(interp); |
| { | ||
| /* Update the stdio encoding to the normalized Python codec name. */ | ||
| PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp); | ||
| PyConfig *config = (PyConfig*)_PyInterpreterState_GetGlobalConfig(interp); |
| 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); |
| { | ||
| PyInterpreterState *interp = _PyInterpreterState_GET(); | ||
| PyConfig *config = (PyConfig *)_PyInterpreterState_GetConfig(interp); | ||
| PyConfig *config = (PyConfig *)_PyInterpreterState_GetGlobalConfig(interp); |
| void | ||
| _PyInterpreterConfig_Clear(_PyInterpreterConfig *config) | ||
| { | ||
| *config = (_PyInterpreterConfig){}; |
| } | ||
|
|
||
| status = _PyConfig_Copy(&tstate->interp->config, &config); | ||
| status = _PyConfig_Copy(&tstate->interp->runtime->config, &config); |
Member
There was a problem hiding this comment.
This seems a very convoluted way to get a static object
Member
|
|
Member
Author
|
Yeah, there are a few things that I need to follow up on here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As part of this, we also move
PyConfig._isolated_interpreterto a new_PyInterpreterConfigstruct and split it up into more granular settings. We also change some of the private API names to explicitly indicate they relate to global config.https://bugs.python.org/issue46964