[issue33653] EnvironmentError does not set errno unless strerror is set

2018-05-26 Thread Eryk Sun
Eryk Sun added the comment: This behavior is inherited from BaseException: https://docs.python.org/3/library/exceptions.html#BaseException >>> str(BaseException()) '' >>> str(BaseException('spam')) 'spam' >>> str(BaseException('spam', 'eggs')) "('spam', 'eggs')" Python

[issue33653] EnvironmentError does not set errno unless strerror is set

2018-05-26 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: My bad, should have read the doc, sorry. =) -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue33653] EnvironmentError does not set errno unless strerror is set

2018-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a documented behavior. If OSError is called with a single argument, it is interpreted as the error message (as in most other exceptions). But if it is called with 2 to 5 arguments, the first argument is interpreted as the errno. https://docs.python.

[issue33653] EnvironmentError does not set errno unless strerror is set

2018-05-26 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola' : >>> 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 i