New submission from Giampaolo Rodola' <g.rod...@gmail.com>:

>>> import errno
>>> OSError(errno.EBADF).errno
>>> OSError(errno.EBADF, "yo").errno
9
>>> IOError(errno.EBADF).errno
>>> IOError(errno.EBADF, "yo").errno
9
>>> EnvironmentError(errno.EBADF).errno
>>> 
>>> EnvironmentError(errno.EBADF, "yo").errno
9

This is a bit annoying mainly when mocking fs-related functions in order to 
raise specific OSError exceptions.

----------
messages: 317737
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: EnvironmentError does not set errno unless strerror is set
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33653>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to