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 giampaolo.rodola
Recipients giampaolo.rodola
Date 2019-10-15.07:34:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571124860.16.0.598909630124.issue38480@roundup.psfhosted.org>
In-reply-to
Content
>>> 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.
History
Date User Action Args
2019-10-15 07:34:20giampaolo.rodolasetrecipients: + giampaolo.rodola
2019-10-15 07:34:20giampaolo.rodolasetmessageid: <1571124860.16.0.598909630124.issue38480@roundup.psfhosted.org>
2019-10-15 07:34:20giampaolo.rodolalinkissue38480 messages
2019-10-15 07:34:19giampaolo.rodolacreate