Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Objective-C wrapper types to use CPython “type data” (negative PyType_Spec.basicsize + PyObject_GetTypeData) instead of dedicated ObjC*Object C structs and per-type headers.
Changes:
- Move wrapper payload fields (e.g.,
SEL,id,Method,Class,BOOL) intoObjC*Datatype-data structs and update implementations to read/write viaPyObject_GetTypeData. - Simplify cache APIs to return/accept
PyObject*rather than per-typeObjC*Object*pointers. - Remove now-redundant per-type headers (
objcbool.h,objcclass.h, etc.) and consolidate relevant declarations inobjctypes_module.h.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| csrc/objctypes_module.h | Adds ObjC*Data structs + PyType_Spec externs; adjusts module-state layout and includes runtime types. |
| csrc/objctypes_cache.h | Removes per-type includes; updates cache function signatures to PyObject* (but introduces a duplicate prototype issue). |
| csrc/objctypes_cache.cc | Adapts cache implementation to store/return PyObject* without per-type casts/includes. |
| csrc/objctypes.c | Removes includes of deleted per-type headers; relies on consolidated declarations. |
| csrc/objcbool.c | Switches ObjCBool storage to type data. |
| csrc/objcclass.c | Switches ObjCClass storage to type data; adjusts construction/caching logic. |
| csrc/objcmetaclass.c | Switches ObjCMetaClass storage to type data. |
| csrc/objcmethod.c | Switches ObjCMethod storage to type data. |
| csrc/objcobject.c | Switches ObjCObject storage to type data and updates cache interactions. |
| csrc/objcselector.c | Switches ObjCSelector storage to type data and updates cache interactions. |
| csrc/objcbool.h | Deleted (definitions replaced by type-data approach). |
| csrc/objcclass.h | Deleted (definitions replaced by type-data approach). |
| csrc/objcmetaclass.h | Deleted (definitions replaced by type-data approach). |
| csrc/objcmethod.h | Deleted (definitions replaced by type-data approach). |
| csrc/objcobject.h | Deleted (definitions replaced by type-data approach). |
| csrc/objcselector.h | Deleted (definitions replaced by type-data approach). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
📚 Documentation preview 📚: https://objctypes--499.org.readthedocs.build/en/499/