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 lukasz.langa
Recipients Unit03, lukasz.langa, martin.panter
Date 2016-05-25.19:52:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464205976.79.0.780709892671.issue27106@psf.upfronthosting.co.za>
In-reply-to
Content
The reason we specifically omitted Error was two-fold:
- the name "Error" is very generic and during a star-import might easily shadow some other class of the same name;
- Error is only a base class for exceptions raised by configparser and as such isn't part of the public API. You can see the same behavior in concurrent.futures for example. However, now I noticed configparser.Error is listed in the documentation so the assertion that "it's not public API" is effectively incorrect.

So I'm torn a little here. On the one hand, it's nice to add Error for completeness. On the other hand, is this change solving a real issue or just satisfying your inner librarian? The reason we have to ask ourselves this question is that this change bears a small risk of breaking user code that was working before. Take a look at this example:
```
from wave import *
from configparser import *

cfg = ConfigParser()
cfg.read('appconfig.ini')
try:
  with Wave_read(cfg['samples']['sad_trombone']) as wav:
    n = wav.getnframes()
    frames = wav.readframes(n)
except Error as e:
  print("Invalid sample:", e)
except KeyError as e:
  print("Can't find {!r} in the config".format(str(e)))
else:
  play_sound(frames)
```
Sure, it's bad code but the point is: it was working before and had a decent error handling strategy. With the change in __all__, it will just crash because wave.Error was never caught.

Is this likely to happen? I don't think so. Knowing my luck, will it happen to somebody? Yeah. So the question remains: why do we want Error in __all__ in the first place? Is it worth it?
History
Date User Action Args
2016-05-25 19:52:56lukasz.langasetrecipients: + lukasz.langa, martin.panter, Unit03
2016-05-25 19:52:56lukasz.langasetmessageid: <1464205976.79.0.780709892671.issue27106@psf.upfronthosting.co.za>
2016-05-25 19:52:56lukasz.langalinkissue27106 messages
2016-05-25 19:52:56lukasz.langacreate