-
Notifications
You must be signed in to change notification settings - Fork 1
Description
- Add helpers to populate modules in C python/cpython#86542
- gh-86542: New C-APIs to simplify module attribute declaration python/cpython#23286
Some years ago, Christian created an issue, and a proposed implementation, for C API that could reduce the amount of boiler-plate code needed when implementing extension modules. Quoting the issue description:
It's currently inconvenient and sometimes error-prone to initialize module members in C. Even stdlib modules are sometimes missing error checks or have reference counting issues in error path. I propose add three helpers to deal with common cases:
- declaration of simple attributes (int, str, bool, float) in an array of structs
- creation and addition of a new type from a type spec
- creation and addition a new exception object
The issue and PR received some initial interest (and I remember being positive to adding these helpers), but the discussion came to a halt after Christian took a break from CPython. Can the C API WG help decide if we should add such APIs? If you suggest these APIs are worth it to implement and maintain, I can volunteer to pick up Christan's work update the PR. If you suggest this is not worth it, we can close the issue and the PR.