This repository was archived by the owner on Aug 21, 2025. It is now read-only.
forked from python-cffi/cffi
-
Notifications
You must be signed in to change notification settings - Fork 2
Replace ct_is_hidden with asserts #7
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
|---|---|---|
|
|
@@ -778,7 +778,7 @@ static int do_realize_lazy_struct(CTypeDescrObject *ct) | |
| { | ||
| /* This is called by force_lazy_struct() in _cffi_backend.c */ | ||
| assert(ct->ct_flags & (CT_STRUCT | CT_UNION)); | ||
|
|
||
| assert(!(ct->ct_flags_mut & CT_UNDER_CONSTRUCTION)); | ||
| if (ct->ct_flags_mut & CT_LAZY_FIELD_LIST) { | ||
| builder_c_t *builder; | ||
| char *p; | ||
|
|
@@ -787,8 +787,8 @@ static int do_realize_lazy_struct(CTypeDescrObject *ct) | |
| const struct _cffi_field_s *fld; | ||
| PyObject *fields, *args, *res; | ||
|
|
||
| assert(!((ct->ct_flags & CT_IS_OPAQUE) || | ||
| (ct->ct_flags_mut & CT_UNDER_CONSTRUCTION))); | ||
| // should have been unset during init for the ctype | ||
|
||
| assert(!(ct->ct_flags & CT_IS_OPAQUE)); | ||
|
|
||
| builder = ct->ct_extra; | ||
| assert(builder != NULL); | ||
|
|
@@ -884,11 +884,11 @@ static int do_realize_lazy_struct(CTypeDescrObject *ct) | |
|
|
||
| assert(ct->ct_stuff != NULL); | ||
| ct->ct_flags_mut &= ~CT_LAZY_FIELD_LIST; | ||
| assert(!(ct->ct_flags_mut & CT_UNDER_CONSTRUCTION)); | ||
| Py_DECREF(res); | ||
| return 1; | ||
| } | ||
| else { | ||
| assert(!(ct->ct_flags_mut & CT_UNDER_CONSTRUCTION)); | ||
| return 0; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
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.
This seems like it might be a temporary assert. I think we can end up with concurrent calls to
do_realize_lazy_struct()on the sameCTypeDescrObjectThere 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.
I think @kumaraditya303 plans to turn the
CT_UNDER_CONSTRUCTIONflag into a uint8 member of theCTypeDescrObjectstruct to facilitate reading and writing to it using atomic operations implemented using something likenpy_atomic.h, which is a bare-bones version ofpyatomic.h.When that refactor is ready this assert can be moved or deleted when we're sure concurrent calls to
b_complete_struct_or_unionare safe.