Skip to content

[DEV] (2.6.0-rc) CAPI Compatibility#42

Merged
MatrixEditor merged 44 commits into
masterfrom
dev/2.6.0-rc
Aug 13, 2025
Merged

[DEV] (2.6.0-rc) CAPI Compatibility#42
MatrixEditor merged 44 commits into
masterfrom
dev/2.6.0-rc

Conversation

@MatrixEditor

Copy link
Copy Markdown
Owner

For more information about what's changed, refer to #40.

Closes #40

---

+ Remove old CAPI
+ Remove CAPI related Tests
+ Fix Doxygen documentation for CAPI
---

+ New Protocols: _ArchLike, _SupportsSetEndian and _EndianLike to support compatibility between CAPI and Python
+ New Python tests for C API arch and endian

arch.h
+ Update CAPI for c_Arch and c_Endian to be compatible to their Python counterparts
+ Change the representation of c_Arch and c_Endian

CAPI
+ Move internal macros into a private header file
Merge pull request #41 from MatrixEditor/dev/2.6.0-rc_capi-endian
---

Field:
+ Update has_flag to use hash(x) instead of ._hash_ attribute access to enable compatibility

Flag:
+ Add custom __eq__ implementation to support equality check with c_Option objects

abc.py:
+ Add new typing-only protocol

c_Option:
+ Add new CAPI Type: CpOptionObject
+
Merge pull request #43 from MatrixEditor/dev/2.6.0-rc_c-option
---

CAPI Changes:
+ Add public C API methods for Context objects
+  Context implementation in C

Python-Side Changes:
+ New customization: O_CONTEXT_FACTORY. Stores a factory that creates custom Context instances
Merge pull request #44 from MatrixEditor/dev/2.6.0-rc_c-context
---

+ Update genapi.py to generate module and private header files
---

+ Updated abc.pyi to include missing protocols
+ Add Atom to CAPI (previously catom)
+ Add LengthInfo to CAPI (previously lengthinfo)
Merge pull request #45 from MatrixEditor/dev/2.6.0-rc_capi-atom
---

+ Add new struct-like: AsLengthRef
---

+ Use a running number instead of a hardcoded index when generating the API
+ New "shared" objects and exceptions stored in shared.c
---

+ Add generic pack,unpack,... operation for atoms (CAPI)

_struct.py:
+ Add missing _is_seq attribute to the root context
---

+ Fix incorrect implementation of CpContext_GetRoot
+ Add constant strings to the CAPI
---

+ New builin atoms: Repeated, Conditional and Switch
+ Read/Write API for all new native atoms
---

+ Update CAPI stubs
---

+ Add and implement CpOffsetAtomObject (AtOffset)
+ Add IO operations to the context
+ Fix reference counting issues with PyDict_GetItem in several places
---

+ Update genapi.py script
Merge pull request #47 from MatrixEditor/dev/2.6.0-rc_capi-builtins
Merge pull request #46 from MatrixEditor/dev/2.6.0-rc_lengthfor
@MatrixEditor MatrixEditor marked this pull request as ready for review July 30, 2025 15:42
---

_common.py:
+ Remove unnecessary import

context.py:
+ New default context path for the ROOT context object

shared.py:
+ Update getstruct and hasstruct to use getattr and hasattr instead of the type's dictionary

shortcuts.py:
+ Add new shortcuts "C" for ctx, "P" for parent and "G" for the root context as ContextPath objects
+ Remove duplicate stub file

fields._base.py:
+ Reduce overhead by pre-computing most states (Adds overhead when creating a field)
---

fields._base.py:
+ Removed calls to `isinstance(X, _ContextLambda)` as this consumes large amount of time
+ Update stubs
+ Revert Field.flags to a simple set
+ Add support for non-context lambda switch fields
---

abc.py:
+ Add .get() to _ContextLike protocol
---

fields.common.py:
+ Fix issue in Prefixed that occurred when the internal struct packs a sequence of elements
+ Add compatibility support for CAPI atoms in Int, UInt and PyStructFormattedField
+ Improved time overhead in PyStructFormattedField with separate implementations for packing single and multiple elements
…cking

---

model._base.py:
+ Add new class _Member to store fields and actions required for packing
+ FIx inconsistent use of default arch and order on members

model._template.py:
+ Fix invalid call to `to_field`

CAPI repeated:
+ Make _field optional when packing
Merge pull request #48 from MatrixEditor/dev/2.6.0-rc_docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEV] (2.6.0) Tracking Changes for 2.6.0 Release

1 participant