Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_resource.py

    r2 r391  
    11import unittest
    22from test import test_support
     3import time
    34
    4 import resource
    5 import time
     5resource = test_support.import_module('resource')
    66
    77# This test is checking a few specific problem spots with the resource module.
     
    104104            pass
    105105
     106    # Issue 6083: Reference counting bug
     107    def test_setrusage_refcount(self):
     108        try:
     109            limits = resource.getrlimit(resource.RLIMIT_CPU)
     110        except AttributeError:
     111            pass
     112        else:
     113            class BadSequence:
     114                def __len__(self):
     115                    return 2
     116                def __getitem__(self, key):
     117                    if key in (0, 1):
     118                        return len(tuple(range(1000000)))
     119                    raise IndexError
     120
     121            resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
     122
    106123def test_main(verbose=None):
    107124    test_support.run_unittest(ResourceTest)
Note: See TracChangeset for help on using the changeset viewer.