4 from test
.test_support
import TESTFN
6 # This test is checking a few specific problem spots. RLIMIT_FSIZE
7 # should be RLIM_INFINITY, which will be a really big number on a
8 # platform with large file support. On these platforms, we need to
9 # test that the get/setrlimit functions properly convert the number to
10 # a C long long and that the conversion doesn't raise an error.
13 cur
, max = resource
.getrlimit(resource
.RLIMIT_FSIZE
)
14 except AttributeError:
17 print resource
.RLIM_INFINITY
== max
18 resource
.setrlimit(resource
.RLIMIT_FSIZE
, (cur
, max))
20 # Now check to see what happens when the RLIMIT_FSIZE is small. Some
21 # versions of Python were terminated by an uncaught SIGXFSZ, but
22 # pythonrun.c has been fixed to ignore that exception. If so, the
23 # write() should return EFBIG when the limit is exceeded.
25 # At least one platform has an unlimited RLIMIT_FSIZE and attempts to
26 # change it raise ValueError instead.
30 resource
.setrlimit(resource
.RLIMIT_FSIZE
, (1024, max))
34 f
= open(TESTFN
, "wb")
45 resource
.setrlimit(resource
.RLIMIT_FSIZE
, (cur
, max))
47 # And be sure that setrlimit is checking for really large values
50 resource
.setrlimit(resource
.RLIMIT_FSIZE
, (too_big
, max))
51 except (OverflowError, ValueError):
54 resource
.setrlimit(resource
.RLIMIT_FSIZE
, (max, too_big
))
55 except (OverflowError, ValueError):