A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-December/123307.html below:

[Python-Dev] Raising OSError concrete classes from errno code

[Python-Dev] Raising OSError concrete classes from errno code [Python-Dev] Raising OSError concrete classes from errno codeBenjamin Peterson benjamin at python.org
Tue Dec 25 23:03:22 CET 2012
2012/12/25 Andrew Svetlov <andrew.svetlov at gmail.com>:
> Currently we have exception tree of classes inherited from OSError
> When we use C API we can call PyErr_SetFromErrno and
> PyErr_SetFromErrnoWithFilename[Object] functions.
> This ones raise concrete exception class (FileNotFoundError for
> example) looking on implicit errno value.
> I cannot see the way to do it from python.
>
> Maybe adding builtin like exception_from_errno(errno, filename=None)
> make some value?
> Function returns exception instance, concrete class depends of errno value

I think a static method on OSError like .from_errno would be good.


-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4