[issue2920] Patch to print symbolic value or errno in EnvironmentError.__str__()
Alexander Belopolsky
report at bugs.python.org
Fri May 28 14:38:39 CEST 2010
Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:
The patch already checks for failed import and falls back to printing
numerical error code. However, I don't like the import either. I will
think about the alternatives.
On May 28, 2010, at 8:27 AM, Antoine Pitrou <report at bugs.python.org>
wrote:
>
> Antoine Pitrou <pitrou at free.fr> added the comment:
>
> Agreed with Amaury. Module import could fail for various reasons
> (perhaps the same ones which led to the exception being raised!), or
> could deadlock if the import lock is being held. Also, having
> __str__ fail is usually very annoying for users (especially when
> it's the __str__ of an exception object).
>
> If it's too hard to import errno at startup (because of
> bootstrapping), I would suggest using PyImport_ImportModuleNoBlock()
> instead, and silence errors (just print the numeric value of errno
> instead).
>
> ----------
> nosy: +pitrou
> versions: +Python 2.7, Python 3.1, Python 3.2
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue2920>
> _______________________________________
----------
nosy: +Alexander.Belopolsky
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2920>
_______________________________________
More information about the Python-bugs-list
mailing list