[Python-checkins] CVS: python/dist/src/Lib
CGIHTTPServer.py,1.21,1.22
Skip Montanaro
skip@pobox.com
Sat, 23 Mar 2002 08:09:16 -0600
>> tighten up except - int() only raises ValueError
Tim> Maybe in context? int() can also raise OverflowError and TypeError
Tim> (e.g., int(1L << 500) and int(1j), respectively).
Yes, in this context. In this situation it is always fed a string, the
value of the Content-Length request header:
length = self.headers.getheader('content-length')
then later (nested):
try:
nbytes = int(length)
except ValueError:
nbytes = 0
Skip