classification
Title: Reorganize pycore_pystate.h header
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2020-04-12 23:01 by vstinner, last changed 2020-04-15 13:50 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19492 merged vstinner, 2020-04-13 00:29
PR 19493 merged vstinner, 2020-04-13 00:39
PR 19505 merged vstinner, 2020-04-13 23:59
PR 19509 merged vstinner, 2020-04-14 12:53
PR 19510 merged vstinner, 2020-04-14 13:55
PR 19515 merged vstinner, 2020-04-14 16:00
PR 19529 merged vstinner, 2020-04-14 23:40
PR 19530 merged vstinner, 2020-04-15 00:12
PR 19531 merged vstinner, 2020-04-15 00:38
PR 19532 merged vstinner, 2020-04-15 00:58
PR 19533 merged vstinner, 2020-04-15 01:27
PR 19536 merged vstinner, 2020-04-15 02:03
Messages (16)
msg366274 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-12 23:01
Over the time, pycore_pystate.h header file becomes more and more complex. It exposes too many internals whereas most consumers only need basic functions like _PyThreadState_GET().

I plan to use this issue as a placeholder for changes to reorganize pycore_pystate.h. I'm working on multiple pull requests.
msg366279 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-13 01:04
New changeset da7933ecc30e37b119756cb02b89a6ad99db22e0 by Victor Stinner in branch 'master':
bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
https://github.com/python/cpython/commit/da7933ecc30e37b119756cb02b89a6ad99db22e0
msg366292 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-13 09:45
New changeset 1c4cbdf94dbb4a6ac1093d2fa7a75efa802b25bc by Victor Stinner in branch 'master':
bpo-40268: Add pycore_runtime.h header file (GH-19493)
https://github.com/python/cpython/commit/1c4cbdf94dbb4a6ac1093d2fa7a75efa802b25bc
msg366352 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-13 23:59
New changeset 0c13e1f96a9487e0efe63c3d3a05ff9738bd7dac by Victor Stinner in branch 'master':
bpo-40241: Add pycore_interp.h header (GH-19499)
https://github.com/python/cpython/commit/0c13e1f96a9487e0efe63c3d3a05ff9738bd7dac
msg366378 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-14 12:26
New changeset 4a3fe0835310643193ea45529ab0fb45c5f8f2fd by Victor Stinner in branch 'master':
bpo-40268: Include explicitly pycore_interp.h (GH-19505)
https://github.com/python/cpython/commit/4a3fe0835310643193ea45529ab0fb45c5f8f2fd
msg366385 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-14 13:14
New changeset 81a7be3fa22c983209cc0ffb3537b92b0370f83c by Victor Stinner in branch 'master':
bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
https://github.com/python/cpython/commit/81a7be3fa22c983209cc0ffb3537b92b0370f83c
msg366395 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-14 15:52
New changeset e5014be0497d06d78343623588a80f491a6f7b74 by Victor Stinner in branch 'master':
bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)
https://github.com/python/cpython/commit/e5014be0497d06d78343623588a80f491a6f7b74
msg366398 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-14 16:30
New changeset e560f90602870601945ea7a4f7770827608817d2 by Victor Stinner in branch 'master':
bpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515)
https://github.com/python/cpython/commit/e560f90602870601945ea7a4f7770827608817d2
msg366465 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-14 23:59
See also bpo-2897: Deprecate structmember.h.
msg366466 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 00:04
New changeset 62183b8d6d49e59c6a98bbdaa65b7ea1415abb7f by Victor Stinner in branch 'master':
bpo-40268: Remove explicit pythread.h includes (#19529)
https://github.com/python/cpython/commit/62183b8d6d49e59c6a98bbdaa65b7ea1415abb7f
msg366467 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 00:35
New changeset 4a21e57fe55076c77b0ee454e1994ca544d09dc0 by Victor Stinner in branch 'master':
bpo-40268: Remove unused structmember.h includes (GH-19530)
https://github.com/python/cpython/commit/4a21e57fe55076c77b0ee454e1994ca544d09dc0
msg366469 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 00:57
New changeset d9ea5cae1d07e1ee8b03540a9367c26205e0e360 by Victor Stinner in branch 'master':
bpo-40268: Remove unused pycore_pymem.h includes (GH-19531)
https://github.com/python/cpython/commit/d9ea5cae1d07e1ee8b03540a9367c26205e0e360
msg366472 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 01:25
New changeset 361dcdcefc80f5729ed18ac0ef73327794fbf400 by Victor Stinner in branch 'master':
bpo-40268: Remove unused osdefs.h includes (GH-19532)
https://github.com/python/cpython/commit/361dcdcefc80f5729ed18ac0ef73327794fbf400
msg366477 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 02:02
New changeset 4f98f465f14e7258c5b18a62c5aa114dbe1174d8 by Victor Stinner in branch 'master':
bpo-40268: Remove unused imports in pylifecycle.c (GH-19533)
https://github.com/python/cpython/commit/4f98f465f14e7258c5b18a62c5aa114dbe1174d8
msg366510 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 13:07
New changeset 5eca75df031d3cbe577c75dd87734b48c787e7f6 by Victor Stinner in branch 'master':
bpo-40268: Reformat posixmodule.c includes (GH-19536)
https://github.com/python/cpython/commit/5eca75df031d3cbe577c75dd87734b48c787e7f6
msg366516 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-15 13:50
> It exposes too many internals whereas most consumers only need basic functions like _PyThreadState_GET().

That's basically done: pycore_pystate.h no longer defines PyInterpreterState structure. pycore_interp.h must now be included explicitly. It's now included by the following files:

* Modules/gcmodule.c
* Modules/_io/textio.c
* Modules/main.c
* Modules/_threadmodule.c
* Objects/codeobject.c
* Objects/interpreteridobject.c
* Objects/longobject.c
* Objects/moduleobject.c
* Objects/unicodeobject.c
* Parser/listnode.c
* Python/codecs.c
* Python/dynload_shlib.c
* Python/import.c
* Python/initconfig.c
* Python/pythonrun.c
* Python/_warnings.c

I also pushed many cleanup changes. I think that it's now enough, I close the issue ;-)
History
Date User Action Args
2020-04-15 13:50:06vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg366516

stage: patch review -> resolved
2020-04-15 13:07:40vstinnersetmessages: + msg366510
2020-04-15 02:03:59vstinnersetpull_requests: + pull_request18884
2020-04-15 02:02:05vstinnersetmessages: + msg366477
2020-04-15 01:27:41vstinnersetpull_requests: + pull_request18883
2020-04-15 01:25:00vstinnersetmessages: + msg366472
2020-04-15 00:58:41vstinnersetpull_requests: + pull_request18882
2020-04-15 00:57:57vstinnersetmessages: + msg366469
2020-04-15 00:38:11vstinnersetpull_requests: + pull_request18881
2020-04-15 00:35:48vstinnersetmessages: + msg366467
2020-04-15 00:12:05vstinnersetpull_requests: + pull_request18880
2020-04-15 00:04:49vstinnersetmessages: + msg366466
2020-04-14 23:59:59vstinnersetmessages: + msg366465
2020-04-14 23:40:31vstinnersetpull_requests: + pull_request18879
2020-04-14 16:30:44vstinnersetmessages: + msg366398
2020-04-14 16:00:16vstinnersetpull_requests: + pull_request18867
2020-04-14 15:52:19vstinnersetmessages: + msg366395
2020-04-14 13:55:22vstinnersetpull_requests: + pull_request18863
2020-04-14 13:14:10vstinnersetmessages: + msg366385
2020-04-14 12:53:33vstinnersetpull_requests: + pull_request18862
2020-04-14 12:26:31vstinnersetmessages: + msg366378
2020-04-13 23:59:51vstinnersetpull_requests: + pull_request18855
2020-04-13 23:59:12vstinnersetmessages: + msg366352
2020-04-13 09:45:24vstinnersetmessages: + msg366292
2020-04-13 01:04:32vstinnersetmessages: + msg366279
2020-04-13 00:39:21vstinnersetpull_requests: + pull_request18846
2020-04-13 00:29:03vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request18845
2020-04-12 23:01:07vstinnercreate