Message354701
>>> import resource
>>> high = 300 * 1024 * 1024
>>> resource.setrlimit(resource.RLIMIT_MEMLOCK, (high, high))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: not allowed to raise maximum limit
>>>
Internally EPERM is translated into ValueError (should have been PermissionError). resource.prlimit(), on the other hand, is not affected (correctly raises PermissionError):
>>> resource.prlimit(os.getpid(), resource.RLIMIT_MEMLOCK, (high, high))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
PermissionError: [Errno 1] Operation not permitted
It seems 'ValueError' was used in order to provide a more informative error message, but IMO it was a bad call.
Proposal is to change this in 3.9 only, and document it under whatsnew/porting. |
|
Date |
User |
Action |
Args |
2019-10-15 07:34:20 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola |
2019-10-15 07:34:20 | giampaolo.rodola | set | messageid: <1571124860.16.0.598909630124.issue38480@roundup.psfhosted.org> |
2019-10-15 07:34:20 | giampaolo.rodola | link | issue38480 messages |
2019-10-15 07:34:19 | giampaolo.rodola | create | |
|