[Rpm-maint] [rpm-software-management/rpm] RFE: Use Python Stable ABI for the bindings (Issue #2345)
Petr Viktorin
notifications at github.com
Wed Jan 11 16:12:13 UTC 2023
Hello,
RPM is typically built/installed as a system component, and the Python bindings are tied to a particular minor (3.x) version of Python. Using the bindings with other Python versions is difficult.
I'd like to solve the issue for `rpm` and similar bindings to “system” packages. There's a few chicken-and-egg problems to untangle in building and installation, but I think a good first step would be building the `_rpm` module with Python's [Stable ABI](https://docs.python.org/3/c-api/stable.html), which means the resulting compiled module would be usable with multiple versions of Python (once copied/linked to the appropriate directory for each Python).
The stable ABI requires using a limited subset of Python's C API, so it'd need some porting. I'm willing to send patches, but I would need reviews and some RPM-specific guidance.
Is this interesting in general?
If so, some details:
- RPM would either need to drop support for Python 3.1, or carry rather large `#ifdef` blocks.
- The implementation could be much less invasive if we disallow loading the `_rpm` module more than once per process. This would limit `rpm`'s use in applications that embed Python and call [`Py_Initialize`](https://docs.python.org/3/c-api/init.html#c.Py_Initialize)/`Py_Finalize` multiple times, or use [sub-interpreters](https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreter). AFAIK, those aren't very relevant for `rpm`. I can go into details if this is an issue.
- The stable ABI would ideally be used for Python 3.10+, with older versions RPM would continue to build version-specific modules. Using the stable ABI for older versions (down to 3.2) is possible, but the lower the version is the more caveats there are.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2345
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/2345 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20230111/17a598e5/attachment.html>
More information about the Rpm-maint
mailing list