msg27113 - (view) |
Author: Tony Meyer (anadelonbrin) |
Date: 2005-12-21 01:41 |
The _winreg documentation says that EnvironmentError will be raised (throughout the docs, for various reasons), when, in every case, WindowsError is actually raised. A simple replace of WindowsError for EnvironmentError would fix this. (Let me know if you really need a patch). |
|
|
msg27114 - (view) |
Author: Fredrik Lundh (effbot) *  |
Date: 2005-12-25 11:44 |
Logged In: YES user_id=38376 however, note that >>> issubclass(WindowsError, EnvironmentError) True on windows, and >>> issubclass(WindowsError, EnvironmentError) Traceback (most recent call last): File "", line 1, in NameError: name 'WindowsError' is not defined on non-windows platforms, so it might be done this way on purpose. |
|
|
msg27115 - (view) |
Author: Tony Meyer (anadelonbrin) |
Date: 2005-12-26 02:36 |
Logged In: YES user_id=552329 I don't see what purpose there is in having the documentation say that EnvironmentError is raised, when a subclass is. _winreg is still marked as a temporary module to be replaced, so it's hard to believe it's some sort of future-proofing. One could say that Exception is raised, since EnvironmentError is a subclass of Exception, but explicit is better than implicit, right? (import _winreg fails on non-Windows platforms, so I don't see how it could be for cross-platform reasons, either). |
|
|
msg27116 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2005-12-27 00:03 |
Logged In: YES user_id=1188172 Corrected in rev. 41829/41830. |
|
|
msg27117 - (view) |
Author: Fredrik Lundh (effbot) *  |
Date: 2005-12-27 08:08 |
Logged In: YES user_id=38376 The original checkin used EnvironmentError in both the documentation and the docstrings, so this is not a result of some accidental editing. Since a good documentation policy for a portable language is to document intended usage, not implementation artifacts, you should at least check with the original authors before you make the documentation depend on the current CPython implementation. (and no, using EnvironmentError is an entirely different thing than using Exception. Can we keep the hyperbolic arguments on comp.lang.python, please?) |
|
|
msg27118 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2005-12-27 17:26 |
Logged In: YES user_id=1188172 You're right. I reverted the checkin, assigning to Fred. |
|
|
msg27119 - (view) |
Author: Fred Drake (fdrake)  |
Date: 2006-04-26 23:19 |
Logged In: YES user_id=3066 Assigning to Mark Hammond since he should be able to tell us what the docs *should* say, and why. |
|
|
msg83896 - (view) |
Author: Mark Hammond (mhammond) *  |
Date: 2009-03-21 00:24 |
oops - this slipped off my radar. I agree with *both* Frederic and Tony :) The module promises to raise an EnvironmentError, which is does. However, the main killer from my POV is that a 'winerror' attribute is likely to be of interest, and this is only available if we promise a WindowsError. In other words, to write code which conformed to the docs, you would need to write: try: ... except WindowsError, exc: if exc.winerror==SOME_INTERESTING_CODE:... except EnvironmentError, exc: # hrmph.. The second except clause is not actually necessary based on the impl, but is according to the docs. For this reason I'd be happy to update the docs to reflect the implementation reality. |
|
|
msg84827 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2009-03-31 16:31 |
Re-fixed in r70832. |
|
|