Setting stacksize in a python script
You can just use the (u)limit command of your shell, if you want:
os.system('ulimit -s unlimited; some_executable')
Or (probably better) use resource.setrlimit:
resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
You're looking for the Python setrlimit interface, resource.RLIMIT_STACK
.
Note that standard users cannot raise their hard limits, only root (well, a process with the CAP_SYS_RESOURCE
capability (see capabilities(7)) processes can raise their limits; so you may need to use the PAM pam_limits(8) limits.conf(5)
file to raise the hard limits for the users in question.