Skip to content

stdlib/typing.pyi IO.name declared str but it should be str | bytes #10737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gpshead opened this issue Sep 20, 2023 · 0 comments · Fixed by #10738
Closed

stdlib/typing.pyi IO.name declared str but it should be str | bytes #10737

gpshead opened this issue Sep 20, 2023 · 0 comments · Fixed by #10738

Comments

@gpshead
Copy link
Member

gpshead commented Sep 20, 2023

Python 3.11.5 (main, Aug 25 2023, 07:43:52) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open(b'/dev/null')
<_io.TextIOWrapper name=b'/dev/null' mode='r' encoding='UTF-8'>

File IO classes can have bytes names, not just str. The name field at construction time and thus name property on IO should thus be str | bytes.

JelleZijlstra added a commit that referenced this issue Sep 20, 2023
Fixes #10737 

Worried this may be too disruptive, but let's see what mypy-primer says.
srittau added a commit to srittau/typeshed that referenced this issue Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant