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 methane
Recipients methane, ned.deily, ronaldoussoren
Date 2019-03-26.09:29:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553592565.66.0.922793998638.issue36432@roundup.psfhosted.org>
In-reply-to
Content
I created simple program calling setrlimit and it succeeds.
I confirmed setrlimit argument is exactly same.
It's very curious why same Python code fails...


== c code
#include <sys/resource.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{
    struct rlimit rl;
    int err;

    err = getrlimit(RLIMIT_STACK, &rl);
    if (err < 0) {
        perror("getrlimit");
        return err;
    }

    printf("%d, soft=%llu, hard=%llu\n", RLIMIT_STACK, rl.rlim_cur, rl.rlim_max);

    err = setrlimit(RLIMIT_STACK, &rl);
    if (err < 0) {
        perror("setrlimit");
        return err;
    }

    return 0;
}

== Python code
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
print("limits=", soft, hard)
resource.setrlimit(resource.RLIMIT_STACK, (soft, hard))

== fails
Traceback (most recent call last):
  File "x.py", line 4, in <module>
    resource.setrlimit(resource.RLIMIT_STACK, (soft, hard))
ValueError: current limit exceeds maximum limit
History
Date User Action Args
2019-03-26 09:29:25methanesetrecipients: + methane, ronaldoussoren, ned.deily
2019-03-26 09:29:25methanesetmessageid: <1553592565.66.0.922793998638.issue36432@roundup.psfhosted.org>
2019-03-26 09:29:25methanelinkissue36432 messages
2019-03-26 09:29:25methanecreate