Skip to content

Correctly handle unavailable .fileno() support for io.BytesIO instances #1174

@wbolster

Description

@wbolster

The changes introduced in 98c9e3b#diff-6607b435d6ee868f251dbdd1a6d0edecL357 are wrong and lead to crashes for io.BytesIO instances which do have a .fileno() method but raise another exception instead:

>>> import io
>>> io.BytesIO().fileno()
Traceback (most recent call last):
  File "<ipython-input-3-7062c09d0c52>", line 1, in <module>
    io.BytesIO().fileno()
UnsupportedOperation: fileno

This exception was already caught properly in the earlier code, a few lines below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions