-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: implement PEP489 (multi-phase module init, heap-allocated types) for Python >= 3.11 #204
base: master
Are you sure you want to change the base?
Conversation
Clarify / regularize static string initialization: it should happen at module intern time, not on-the-fly.
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.
@tseaver Sorry I lost track of this one. I haven't reviewed the whole thing yet; so far I looked at the headers and _timestamp.c
I tried running
|
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.
Review of cPersistence.c
It names APIs which *were* added in Python 3.9, but we need others not available until 3.11.
… into tseaver-pep489
@davisagli |
- Remove 'tp_dealloc' / 'tp_clear' slots (there are no allocated members). - Use 'timestamp_type->tp_alloc' rather than 'PyObject_New'.
Creating instances of 'type' or 'tuple' via 'PyType_GenericNew' leaves them in states which trigger assertions in their 'tp_dealloc' slots. These assertions are normally silent, but trigger when running under a Python built using '--with-debug' or '--with-assertions'.
@davisagli The last four commits clear up the remaining issues: tests now pass without segfaults under both "normal" Python >= 3.11 and under a |
That struct is actually just a borrowed pointer to the struct held in the module state of the 'cPersistence' extension module. Visiting / clearing it from withing 'cPickleCache' is inappropriate, and may lead to segfaults during program exit.
@davisagli re c8b34ca: I backed out the |
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.
You mentioned that this will be disruptive. Should we bump the major version as part of merging this?
I'm not sure. Likely should try installing the wheel built from this branch into tox environments for the |
Older Python versions continue to use static type init and static classes, although static state has been moved into the module state unconditionally.
I realize these changes are likely to be disruptive, in particular, for
BTrees
, which I plan to handle next.