+if __name__ == '__main__':
+ stacklim = 512*1024 # 0.5 MiB
+ curlim = resource.getrlimit(resource.RLIMIT_STACK)[0] # soft limit
+ if curlim > stacklim:
+ resource.setrlimit(resource.RLIMIT_STACK, (stacklim, stacklim))
+ # for some reason, doesn't take effect properly without the exec()
+ python = '/usr/bin/python'
+ os.execv(python, [python] + savedargv)
+ run()