-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Milestone
Description
Describe the bug
The imghdr
module is deprecated in Python 3.11 by PEP 594 and is slated for removal in Python 3.13.
imghdr
is used here to guess image mimetypes:
Lines 50 to 55 in 31eba1a
def guess_mimetype_for_stream(stream: IO, default: Optional[str] = None) -> Optional[str]: | |
imgtype = imghdr.what(stream) | |
if imgtype: | |
return 'image/' + imgtype | |
else: | |
return default |
The imghdr
code is not very large (see here). It could either be vendored by Sphinx or pulled out to a package on PyPI if there's no alternative.
Python version
Python 3.11.0.beta1
hugovk