-
Notifications
You must be signed in to change notification settings - Fork 29
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: add PEP 489 support #209
Open
tseaver
wants to merge
78
commits into
master
Choose a base branch
from
tseaver-pep489
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
It is initialized with what turns out to be '&PyBaseObject_Type', which we can just use as is.
Note that we aren't storing it on the module state record yet, as that triggers segfaults.
Requires overriding all the macros from 'cPersistence.h', most of which (irony, anyone?) exist only for our benefit.
Still forced static, for now.
Prep for heap-allocating them.
- Use consistent naming, w/ '_type_def' suffix (for easy comparison with forthcoming '_type_spec' for heap-allocated types). - Use named members, removing clutter. - Move protocol specs (number, sequence, mepping) next to type definitions, to ease constructino of equivalent '_type_slots' for heap-allocated types. - Add TODOs to locations outside module initialization which use the addresses of type defs: they need to look them up on the module state.
Verses addresses of the static type defs.
Avoid segfault at application exit.
Avoids 'PyObject_New' FBO heap-allocated types, but works just as well for the statid types.
And use its 'tp_alloc' slot, rather than calling it as an object.
Both faster and easier to reason about. One exception is the call to create a new bucket for a tree, which has to live with the promise made to respect the '_bucket_type' attribute on derived classes.
Heap-allocated BTrees et. all still segfault.
Use static inlined versions, to placate compilers which don't allow 'foreign' function pointers in static initializers.
Their arguments cannot be guaranteed to be instances of our types, which means we cannot use them to dead-reckon to the module. All callers have, or can easily derive, the module anyway.
Ensure that we play nicely with 'Persistent', whether it is heap-allocated or no.
Rather than dead-reckoning from types of args, make callers pass in the module (they probably have it already at this point).
In prepration for dropping the others and renaming the '_from_module' ones
Takes either a module or a BTree-ish object, and returns the PerCAPI*. Will replace both '_get_capi_struct' and '_get_capi_struct_from_module'.
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.
This PR sits atop #208. You might find easier just to review this one, even though it is huge.