-
Notifications
You must be signed in to change notification settings - Fork 2
Replace ct_is_hidden with asserts #7
Conversation
(Kumar will fix this soon!)
|
Looks like CI passes - this is ready for review. |
src/c/realize_c_type.c
Outdated
|
|
||
| assert(!((ct->ct_flags & CT_IS_OPAQUE) || | ||
| (ct->ct_flags_mut & CT_UNDER_CONSTRUCTION))); | ||
| // should have been unset during init for the ctype |
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.
I'm not sure I understand this comment. I'd think that the assert below is because opaque structs never have lazy field lists.
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.
I'd think that the assert below is because opaque structs never have lazy field lists.
This is what I was going for. I'll edit the comment.
| /* 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)); |
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 same CTypeDescrObject
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.
I think @kumaraditya303 plans to turn the CT_UNDER_CONSTRUCTION flag into a uint8 member of the CTypeDescrObject struct to facilitate reading and writing to it using atomic operations implemented using something like npy_atomic.h, which is a bare-bones version of pyatomic.h.
When that refactor is ready this assert can be moved or deleted when we're sure concurrent calls to b_complete_struct_or_union are safe.
Followup for #5 to more fully disentangle
CT_IS_OPAQUEfromCT_UNDER_CONSTRUCTION.