#1144468 python-psutil: RLIM_INFINITY changes in python 3.15

#1144468#5
Date:
2026-08-15 13:37:04 UTC
From:
To:
Package: src:python-psutil
Version: 7.1.0-1
User: debian-python@lists.debian.org
Usertags: python3.15

Hi!

While rebuilding packages against Python 3.15 we found that
python-psutil produces some errors in the tests. This is due to a change
in Python 3.15 resources handling
(https://docs.python.org/3.15/whatsnew/3.15.html#porting-to-python-3-15):

  - resource.RLIM_INFINITY is now always positive. Passing a negative
    integer value that corresponded to its old value (such as -1 or -3,
    depending on platform) to resource.setrlimit() and resource.prlimit()
    is now deprecated. (Contributed by Serhiy Storchaka in gh-137044.)

While python-psutil tests rely on RLIM_INFINITY to be -1.

Note that this was already a problem when building against pypy and the
tests were skipped to build against pypy.

As there are many dependencies that require psutil I'm applying the
attached patch to the package in the build sandbox (we are using the
debusine.debian.net provided by freexian to make the test the rebuilds).
But while the patch seems to be inline with what upstream plans to do
for the version 8.0 it might be worth having a conversation as otherwise
psutils.RLIM_INFINITY will be different to resource.RLIM_INFINITY. Which
seems to be an overlooked consequence of the current fix.

(To be fair, allowing psutils.RLIM_INFINITY to change when psutil builds
against Python 3.15 is a minor api breakage, which might not be
acceptable for python-psutil upstream developers.)

Please consider either applying this patch or something similar to the
psutil package to allow it to build against Python 3.15.

Happy hacking,