[New-bugs-announce] [issue33653] EnvironmentError does not set errno unless strerror is set

Giampaolo Rodola' report at bugs.python.org
Sat May 26 07:06:26 EDT 2018


New submission from Giampaolo Rodola' <g.rodola at 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 <report at bugs.python.org>
<https://bugs.python.org/issue33653>
_______________________________________


More information about the New-bugs-announce mailing list