problem with setrlimit on Linux 2.2?

Charles G Waldman cgw at fnal.gov
Thu Feb 10 15:17:41 EST 2000


I'm sure that just as soon as I press "send", I'll realize that
something trivial is wrong with this code:

#!/usr/bin/env python

import sys,os,resource,signal

def sorry(*args):
    print "Sorry, time's up"
    

signal.signal(signal.SIGXCPU, signal.SIG_IGN)
resource.setrlimit(resource.RLIMIT_CPU,(10,10))
s='2L'
while 1:
    print s,'=',eval(s)
    s=s+'**2L'
    
    


When I run this, instead of getting the "Sorry, time's up" message my
Python process is unceremoniously killed.


Python 1.5.2+ (#14, Feb 10 2000, 13:20:30)  [GCC 2.95.2 19991024 (release)] on linux2
Linux 2.2.14 #5 SMP Wed Jan 5 15:18:40 CST 2000 i686 unknown
glibc-2.1.1-6

Does the above example work for anyone on other platforms?  Is this a
Linux problem or a Python problem?





More information about the Python-list mailing list