c-abi#13
Merged
Merged
Conversation
Public C ABI for downstream extensions, enabling C-level participation in behavior-oriented concurrency across worker sub-interpreters. **New Features** - **Decorator composition with ``@when``** — decorators stacked below ``@when`` are now preserved on the generated behavior function and compose with the behavior body on the worker. Decorators placed above ``@when`` raise a ``SyntaxError`` at transpile time with actionable guidance. ``async def`` functions with ``@when`` are also explicitly rejected. - **Public C ABI (`<bocpy/bocpy.h>`)** — downstream C extensions can now link against bocpy to register custom Python types as cross-interpreter shareable so :class:`Cown` can carry instances of them across worker interpreters. The header is C-only, version-gated via the ``BOCPY_ABI`` macro, and bumped on any incompatible change to ``bocpy.h`` or ``xidata.h``. Wheels remain CPython-version-tagged so a runtime ABI mismatch cannot occur. - **`bocpy.get_include()` / `bocpy.get_sources()`** — Python-level helpers that downstream ``setup.py`` files use to locate the bocpy headers and the small set of C sources that must be compiled into the consuming extension. - **`templates/c_abi_consumer/`** — a ready-to-copy template for building a C extension against the bocpy ABI, including a ``setup.py``, a probe extension exercising the public surface, and a pytest suite (``test_public_c_abi.py``) that validates the ABI end-to-end. - **C source reorganisation** — the per-subsystem translation units introduced in 0.5.0 have been renamed with a ``boc_`` prefix (``boc_compat.[ch]``, ``boc_sched.[ch]``, ``boc_tags.[ch]``, ``boc_terminator.[ch]``, ``boc_noticeboard.[ch]``, ``boc_cown.h``) to give the public ABI a stable, namespaced identity. ``xidata.h`` has moved under ``include/bocpy/`` alongside ``bocpy.h``. **Documentation** - New :doc:`c_abi`, :doc:`messaging`, and :doc:`noticeboard` pages in the Sphinx site; the API reference has been expanded to cover the public ABI surface. **Breaking Changes** - **`noticeboard_version` removed** — the global monotonic version counter introduced in 0.4.0 has been removed. It exposed an implementation detail of the snapshot cache that did not survive the C ABI review and had no use case that was not better served by ``notice_sync`` plus an explicit ``noticeboard()`` read. Signed-off-by: Matthew A Johnson <matthew@matthewajohnson.org> Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
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.
Public C ABI for downstream extensions, enabling C-level participation
in behavior-oriented concurrency across worker sub-interpreters.
New Features
@when— decorators stacked below@whenare now preserved on the generated behavior function andcompose with the behavior body on the worker. Decorators placed
above
@whenraise aSyntaxErrorat transpile time withactionable guidance.
async deffunctions with@whenarealso explicitly rejected.
<bocpy/bocpy.h>) — downstream C extensions cannow link against bocpy to register custom Python types as
cross-interpreter shareable so :class:
Cowncan carry instances ofthem across worker interpreters. The header is C-only, version-gated
via the
BOCPY_ABImacro, and bumped on any incompatible changeto
bocpy.horxidata.h. Wheels remain CPython-version-taggedso a runtime ABI mismatch cannot occur.
bocpy.get_include()/bocpy.get_sources()— Python-levelhelpers that downstream
setup.pyfiles use to locate the bocpyheaders and the small set of C sources that must be compiled into
the consuming extension.
templates/c_abi_consumer/— a ready-to-copy template forbuilding a C extension against the bocpy ABI, including a
setup.py, a probe extension exercising the public surface, anda pytest suite (
test_public_c_abi.py) that validates the ABIend-to-end.
introduced in 0.5.0 have been renamed with a
boc_prefix(
boc_compat.[ch],boc_sched.[ch],boc_tags.[ch],boc_terminator.[ch],boc_noticeboard.[ch],boc_cown.h)to give the public ABI a stable, namespaced identity.
xidata.hhas moved under
include/bocpy/alongsidebocpy.h.Documentation
c_abi, :doc:messaging, and :doc:noticeboardpagesin the Sphinx site; the API reference has been expanded to cover
the public ABI surface.
Breaking Changes
noticeboard_versionremoved — the global monotonic versioncounter introduced in 0.4.0 has been removed. It exposed an
implementation detail of the snapshot cache that did not survive
the C ABI review and had no use case that was not better served
by
notice_syncplus an explicitnoticeboard()read.