> Requiring Python >= 3.7 is not a problem, I'm just curious as to what makes
> that particular version special.
[`PySlice_GetIndicesEx`](https://docs.python.org/3/c-api/slice.html#c.PySlice_GetIndicesEx)
uses a deprecated implementation (on all Python versions) if ABI compatibility
with 3.6 is needed.
That implementation is only unsafe in rather exotic edge cases ([indexing by an
object that has side-effects on conversion to `int`, or another thread changing
a sequence size](https://github.com/python/cpython/issues/72054)), but it does
emit a compile-time warning.
If y'all can live with the warning, I think (but haven't checked), that would
allow ABI compatibility with Python 3.4+. But, IMO it's better to use
version-specific ABI for such old Python versions.
> Requiring Python >= 3.7 is not a problem, I'm just curious as to what makes
> that particular version special. Cmake >= 3.26 is too new for us to require
> though, but this shouldn't be hard to do manually. Looking at the cmake's
> FindPython module, something like target_compile_definitions(_rpm PRIVATE
> Py_LIMITED_API=x) (where x is the desired version obviosly) for in
> python/CMakeLists.txt I suppose. There's something about linking to a
> specific library too, but according to
> https://docs.python.org/3/c-api/stable.html that's a Windows-only thing.
Here's what's different for stable ABI builds:
- Compiling with `Py_LIMITED_API=0x03070000`, so only “stable” API is allowed.
- Naming the `.so` appropriately. Currently `cmake` outputs `_rpm.so`, which
doesn't need to change -- any Python will load it. In the future CMake *might*
switch to `_rpm.cpython-311-x86_64-linux-gnu.so`/`_rpm.abi3.so`, but I bet
it'll use a `cmake_policy` for that kind of change, so there'll be plenty of
time to adjust.
- On Windows, linking with a different Python library if appropriate
So, yeah, adding `target_compile_definitions(_rpm PRIVATE
Py_LIMITED_API=Py_LIMITED_API=0x03070000)` will do the trick.
But it might be better to use CMake's `Development.SABIModule` if it's
available?
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2674#issuecomment-1743057129
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2674/c1743057...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint