[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Packages whith “except” overwriting builtins



Hi Jakub,

2010/8/3 Jakub Wilk <jwilk@debian.org>:
> You might be easily mislead into thinking that this code
>
>   try:
>      eggs()
>   except IOError, OSError:
>      pass
>
> will catch both IOError and OSError exceptions. In fact, it will not, as it
> is more or less equivalent to:
>
>   try:
>      eggs()
>   except IOError, ex:
>      OSError = ex  # Whoo, overwrite the built-in name

Just a reference to how properly catch them:
http://docs.python.org/tutorial/errors.html#handling-exceptions

> Sandro Tosi <morph@debian.org>
>   python-reportbug (U)

Fixed at 85174c0: thanks!

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


Reply to: