Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-89546: Clean up PyType_FromMetaclass#93686
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
19 commits Select commitHold shift + click to select a range
d43d5ca Raise invalid slot exceptions early
encukou5145034 Switch to `switch` for the slots
encukou87b28aa Allocate & copy the docstring early
encukou9fb6b11 Prepare the type names early
encukou7fd0c6d Move offset setting to before PyType_Ready
encukou06fe302 Add comment on preparing special slots
encukou8bb54f8 Comment that we don't want to call Python code while a type is half-b…
encukou6c25cfc Add comment on the function's refcounting strategy
encukou7edb478 Check that base & offsets fit in the basicsize
encukou2075958 Add blurb for the new check
encukou763ea2d Move variable declarations out of `switch` cases
encukou5ca1502 Fix ReST syntax (*sigh*)
encukou5b18552 Downcast to int to avoid a warning
encukou34edc2a Reflow check_basicsize_includes_size_and_offsets to conform to style …
encukoue45f77f Reword error messages to say "offset is out of bounds"
encukou9713fb4 Move modname down to improve scoping
encukoua997413 Move variables to smaller scopes
encukoub197bb5 Merge main branch to resolve conflicts
encukouf53d86c One more PEP 7 nit!
encukouFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Add comment on the function's refcounting strategy
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit6c25cfcda973ed5cca2ed6c7daec34af3f5302db
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3402,13 +3402,18 @@ PyObject * | ||
| PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, | ||
| PyType_Spec *spec, PyObject *bases_in) | ||
| { | ||
| /* Invariant: A non-NULL value in one of these means this function holds | ||
| * a strong reference or owns allocated memory. | ||
| * These get decrefed/freed/returned at the end, on both success and error. | ||
| */ | ||
| PyHeapTypeObject *res = NULL; | ||
| PyObject *modname = NULL; | ||
encukou marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| PyTypeObject *type; | ||
| PyObject *bases = NULL; | ||
| char *tp_doc = NULL; | ||
| PyObject *ht_name = NULL; | ||
| char *_ht_tpname = NULL; | ||
| int r; | ||
| /* Prepare slots that need special handling. | ||
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.