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:
|
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
Describe the bug
The
imghdrmodule is deprecated in Python 3.11 by PEP 594 and is slated for removal in Python 3.13.imghdris used here to guess image mimetypes:sphinx/sphinx/util/images.py
Lines 50 to 55 in 31eba1a
The
imghdrcode 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