[llvm] [lit] Normalize RLIM_INFINITY to -1 in print_limits.py for Python 3.15+ (PR #190953)

Miro HronĨok via llvm-commits llvm-commits at lists.llvm.org
Mon May 25 04:17:08 PDT 2026


================
@@ -1,6 +1,22 @@
 import resource
 
-print("RLIMIT_AS=" + str(resource.getrlimit(resource.RLIMIT_AS)[0]))
-print("RLIMIT_NOFILE=" + str(resource.getrlimit(resource.RLIMIT_NOFILE)[0]))
-print("RLIMIT_STACK=" + str(resource.getrlimit(resource.RLIMIT_STACK)[0]))
-print("RLIMIT_FSIZE=" + str(resource.getrlimit(resource.RLIMIT_FSIZE)[0]))
+
+def normalize_limit(limit_value):
+    """Normalize RLIM_INFINITY to -1 for consistency across Python versions.
+
+    Python 3.15+ returns the platform's max value (e.g., 2^64-1) instead of -1.
+    """
+    return -1 if limit_value == resource.RLIM_INFINITY else limit_value
----------------
hroncok wrote:

As said, I don't care either way. Feel free to apply that suggestion or not.

https://github.com/llvm/llvm-project/pull/190953


More information about the llvm-commits mailing list