This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author imz
Recipients abacabadabacaba, belopolsky, billm, georg.brandl, gregory.p.smith, imz, loewis, python-dev, serhiy.storchaka
Date 2018-03-22.18:47:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521744454.53.0.467229070634.issue6083@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks! I also thought about this simplest way. What about this:

diff --git a/Python/Lib/test/test_resource.py b/Python/Lib/test/test_resource.py
index de29d3b..bec4440 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 _:
+            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())

What should I write instead of _?
History
Date User Action Args
2018-03-22 18:47:34imzsetrecipients: + imz, loewis, georg.brandl, gregory.p.smith, belopolsky, billm, abacabadabacaba, python-dev, serhiy.storchaka
2018-03-22 18:47:34imzsetmessageid: <1521744454.53.0.467229070634.issue6083@psf.upfronthosting.co.za>
2018-03-22 18:47:34imzlinkissue6083 messages
2018-03-22 18:47:34imzcreate