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
PEP 3121, 384 refactoring applied to dbm module #59855
Comments
Robin, why do you increment refcounter for type object on every construction of dbm instance? Also I would to see macros in uppercase if possible. |
PEP-384 demands, among other things, that the TypeObjects themselves are transformed to Heaptypes. This means that the Typeobjects, that are created from this new stable ABI, reside within the heap and therefore have to be managed by the Python GC. This is of course done by appropriately incref- and decrefing of the specific Heaptype. |
From my perspective type object is referenced by module state. Instances of python classes (not extensions) hold ownership for it's class. I guess it done because python class can be constructed inside function and instance of this class should work after exit from that function like closure does. In case of extension modules enough to hold type reference into module state itself. Thoughts? |
Robin, after thinking I would to agree with your decision to hold reference to type into type instance. Please, can you describe your check like: if((void *)type->tp_dealloc == (void *)dbm_dealloc) {
Py_DECREF(type);
} Why you decref only if type->tp_dealloc points to module's dealloc? What are you protected from? What other values also possible? |
Take a look at the discussion in bpo-15653. |
Fixed by: commit bf69a8f
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: