homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author beazley
Recipients beazley
Date 2008年12月17日.20:22:40
SpamBayes Score 4.555456e-11
Marked as misclassified No
Message-id <1229545362.85.0.86911392572.issue4686@psf.upfronthosting.co.za>
In-reply-to
Content
The ConfigParser module defines a variety of custom exceptions, many of 
which take more than one argument (e.g., InterpolationError, 
NoOptionError, etc.). However, none of these exceptions properly set 
the .args attribute. For example, shouldn't NoOptionError be defined 
as follows:
class NoOptionError(Error):
 def __init__(self,option,section):
 Error.__init__(self,"No option %r in section: %r" %
 (option,section))
 self.option = option
 self.section = section
 self.args = (option,section) #!! Added this line
This is kind of a minor point, but the missing args means that these 
exceptions don't work properly with programs that need to do fancy kinds 
of exception processing (i.e., catching errors and reraising them in a 
different context or process).
I can't speak for Python 3.0, but it's my understanding that .args 
should always be set to the exception arguments.
Don't ask how I came across this---it was the source of a really bizarre 
bug in something I was playing around with.
History
Date User Action Args
2008年12月17日 20:22:42beazleysetrecipients: + beazley
2008年12月17日 20:22:42beazleysetmessageid: <1229545362.85.0.86911392572.issue4686@psf.upfronthosting.co.za>
2008年12月17日 20:22:42beazleylinkissue4686 messages
2008年12月17日 20:22:40beazleycreate

AltStyle によって変換されたページ (->オリジナル) /