-
-
Notifications
You must be signed in to change notification settings - Fork 28
Description
PEP-687 is about to be implemented to the _datetime
module.
Two approaches are proposed at present. I would like Steering Council to choose one.
-
(regular)
Multi-phase-init with per-module heaptypes (and C-API).
abi: Store a reference (to the C-API struct) inPyInterpreterState
. -
(special)
Multi-phase-init with per-interpreter heaptypes (and C-API).
abi: Store at least 7 heaptypes' references inPyInterpreterState
.
The following shows the replacements of _datetime
heaptypes (multi-phase init module) when running test_datetime
in the refleak test:
main interp sequence | 1.per-module | 2.per-interp |
---|---|---|
import module | heaptypes_A | heaptypes_A |
module reload (new module) | heaptypes_B (new) | (no change) |
module reload (new module) | heaptypes_C (new) | (no change) |
interp finish |
The approach (2) avoids possible regressions1 caused by mixing modules with forbidden hacky usage23. Technically, (2) does not make sense (1) should be enough. In my opinion, unknown regressions should not be hidden by (2). Also, (2) will be a bad official example of isolation. However, there seems to be a case where maintaining (1) is not good for mental health, which is also serious.
Related issue/PR: gh-117398, gh-118357
Thanks
UPDATED: a few rewords