Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37399702
en ru br
ALT Linux repos
S:2.7.18-alt11
5.0: 2.5.4-alt5
4.1: 2.5.4-alt0.M41.1
4.0: 2.4.5-alt0.M40.1
3.0: 2.4.1-alt5

Group :: Development/Python
RPM: python

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: python-2.7.14-alt-test_resource-skip-impossible.patch
Download


As discusssed in https://bugs.python.org/issue6083#msg314264 .
diff --git a/Python/Lib/test/test_resource.py b/Python/Lib/test/test_resource.py
index de29d3b..27a1573 100644
--- a/Python/Lib/test/test_resource.py
+++ b/Python/Lib/test/test_resource.py
@@ -102,16 +102,21 @@ class ResourceTest(unittest.TestCase):
 
     # Issue 6083: Reference counting bug
     def test_setrusage_refcount(self):
+        howmany = 1000000
         try:
             limits = resource.getrlimit(resource.RLIMIT_CPU)
         except AttributeError:
             self.skipTest('RLIMIT_CPU not available')
+        try:
+            resource.setrlimit(resource.RLIMIT_CPU, (howmany, howmany))
+        except (ValueError, OSError):
+            self.skipTest('Setting RLIMIT_CPU not possible')
         class BadSequence:
             def __len__(self):
                 return 2
             def __getitem__(self, key):
                 if key in (0, 1):
-                    return len(tuple(range(1000000)))
+                    return len(tuple(range(howmany)))
                 raise IndexError
 
         resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin