This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use _PyCoreConfig rather than global configuration variables
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2019-05-13 11:07 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13278 merged vstinner, 2019-05-13 12:55
PR 13299 merged vstinner, 2019-05-13 22:38
PR 13614 merged vstinner, 2019-05-28 09:06
Messages (6)
msg342310 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-13 11:07
PyInterpreterState.config is now preferred over global configuration variables, so two interpreters can have a different configuration, the "state" of an interpreter is now better defined (especially when and how its configuration is set).

Attached PRs fix these isssues.
msg342338 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-13 15:12
New changeset 410b85a7f701be280eb15b0ca4fe116e86f1d008 by Victor Stinner in branch 'master':
bpo-36900: import.c uses PyInterpreterState.core_config (GH-13278)
https://github.com/python/cpython/commit/410b85a7f701be280eb15b0ca4fe116e86f1d008
msg342398 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-13 23:03
With PR 13299, most global variable configurables are not directly accessed, outside code to initialize _PyPreConfig and _PyCoreConfig.

parser.c: Py_DebugFlag
fileutils.c: Py_UTF8Mode, Py_LegacyWindowsFSEncodingFlag
frozenmain.c: Py_VerboseFlag
Py_FdIsInteractive(): Py_InteractiveFlag
PySys_SetArgv(): Py_IsolatedFlag()
Py_GETENV(): Py_IsolatedFlag

The problem is that these files, functions and macros may be used before Python is initialized: before Python has an interpreter.
msg342478 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-14 15:35
New changeset c96be811fa7da8ddcea18cc7abcae94e0f5ff966 by Victor Stinner in branch 'master':
bpo-36900: Replace global conf vars with config (GH-13299)
https://github.com/python/cpython/commit/c96be811fa7da8ddcea18cc7abcae94e0f5ff966
msg342479 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-14 15:35
There are a few remaining usage of these global configuration variables, but it will be tricky to remove them:
https://bugs.python.org/issue36900#msg342398

I consider that I'm done on this topic, so I close the issue.
msg343760 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-28 10:24
New changeset 9ea277a788eabec102e8fe613b7f1e27995d5918 by Victor Stinner in branch 'master':
bpo-36900: Fix compilation on HP-UX (GH-13614)
https://github.com/python/cpython/commit/9ea277a788eabec102e8fe613b7f1e27995d5918
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81081
2019-05-28 10:24:04vstinnersetmessages: + msg343760
2019-05-28 09:06:46vstinnersetpull_requests: + pull_request13517
2019-05-14 15:35:57vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg342479

stage: patch review -> resolved
2019-05-14 15:35:11vstinnersetmessages: + msg342478
2019-05-13 23:03:35vstinnersetmessages: + msg342398
2019-05-13 22:38:58vstinnersetpull_requests: + pull_request13210
2019-05-13 15:12:53vstinnersetmessages: + msg342338
2019-05-13 12:55:21vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13184
2019-05-13 11:07:28vstinnercreate