[Python-Dev] Raising OSError concrete classes from errno code (original) (raw)
Andrew Svetlov andrew.svetlov at gmail.com
Tue Dec 25 23:05:26 CET 2012
- Previous message: [Python-Dev] Raising OSError concrete classes from errno code
- Next message: [Python-Dev] Raising OSError concrete classes from errno code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
static method is better than new builtin function, agree.
On Wed, Dec 26, 2012 at 12:03 AM, Benjamin Peterson <benjamin at python.org> wrote:
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 PyErrSetFromErrno and PyErrSetFromErrnoWithFilename[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 exceptionfromerrno(errno, filename=None) make some value? Function returns exception instance, concrete class depends of errno value I think a static method on OSError like .fromerrno would be good. -- Regards, Benjamin
-- Thanks, Andrew Svetlov
- Previous message: [Python-Dev] Raising OSError concrete classes from errno code
- Next message: [Python-Dev] Raising OSError concrete classes from errno code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]