-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add BytesIO alias to fix missing references in docs #7737
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
Conversation
Do you know where this is coming from? |
|
This name can be observed from the console: Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> io.BytesIO
<class '_io.BytesIO'>However, it is listed under I'm not sure if this would qualify as a CPython bug, a docs.python.org bug, or a sphinx autodoc bug. |
|
I wonder what's changed for it to start happening now? The last Python releases were in December, and Sphinx was in September. The direct docs dependencies also haven't recently changed. It feels like something that should be fixed upstream, somewhere, if possible... |
|
|
||
| # io.BytesIO is incorrectly converted to _io.BytesIO, this alias prevents that | ||
| autodoc_type_aliases = { | ||
| "BytesIO": "~io.BytesIO", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "BytesIO": "~io.BytesIO", | |
| "BytesIO": "io.BytesIO", |
I find that the tilde isn't necessary? radarhere@f698cb9 / https://github.com/radarhere/Pillow/actions/runs/7599204419/job/20695972684
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tilde is for consistency with other types.
With the tilde:

Compare with e.g. typing.BinaryIO:

|
Closing, in favour of #7750 |

A warning has started appearing in the Docs build in main due to type hints added in #7727 and #7728.
This PR fixes it using
autodoc_type_aliases.