Skip to content

Commit e399f46

Browse files
authored
gh-104773: PEP 594: Remove the imghdr module (#104777)
* Remove the Lib/test/imghdrdata/ directory. * Copy 5 pictures (gif, png, ppm, pgm, xbm) from removed Lib/test/imghdrdata/ to a new Lib/test/tkinterdata/ directory. * Update Sphinx from 4.5 to 6.2 in Doc/requirements.txt.
1 parent ba73473 commit e399f46

28 files changed

+21
-425
lines changed

Diff for: Doc/library/imghdr.rst

-86
This file was deleted.

Diff for: Doc/library/superseded.rst

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ backwards compatibility. They have been superseded by other modules.
1010

1111
.. toctree::
1212

13-
imghdr.rst
1413
optparse.rst

Diff for: Doc/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# Sphinx version is pinned so that new versions that introduce new warnings
77
# won't suddenly cause build failures. Updating the version is fine as long
88
# as no warnings are raised by doing so.
9-
sphinx==4.5.0
9+
# PR #104777: Sphinx 6.2 no longer uses imghdr, removed in Python 3.13.
10+
sphinx==6.2.0
1011

1112
blurb
1213

Diff for: Doc/whatsnew/3.11.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,7 @@ Modules
17351735
+---------------------+---------------------+---------------------+---------------------+---------------------+
17361736
| :mod:`!audioop` | :mod:`!crypt` | :mod:`!nis` | :mod:`!sndhdr` | :mod:`!uu` |
17371737
+---------------------+---------------------+---------------------+---------------------+---------------------+
1738-
| :mod:`!cgi` | :mod:`imghdr` | :mod:`!nntplib` | :mod:`!spwd` | :mod:`!xdrlib` |
1738+
| :mod:`!cgi` | :mod:`!imghdr` | :mod:`!nntplib` | :mod:`!spwd` | :mod:`!xdrlib` |
17391739
+---------------------+---------------------+---------------------+---------------------+---------------------+
17401740
| :mod:`!cgitb` | :mod:`!mailcap` | :mod:`!ossaudiodev` | :mod:`!sunau` | |
17411741
+---------------------+---------------------+---------------------+---------------------+---------------------+

Diff for: Doc/whatsnew/3.12.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ Modules (see :pep:`594`):
924924
* :mod:`!cgitb`
925925
* :mod:`!chunk`
926926
* :mod:`!crypt`
927-
* :mod:`imghdr`
927+
* :mod:`!imghdr`
928928
* :mod:`!mailcap`
929929
* :mod:`!msilib`
930930
* :mod:`!nis`

Diff for: Doc/whatsnew/3.13.rst

+8
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ Removed
244244
:class:`typing.TypedDict` types, deprecated in Python 3.11.
245245
(Contributed by Tomas Roun in :gh:`104786`.)
246246

247+
* :pep:`594`: Remove the :mod:`!imghdr` module, deprecated in Python 3.11:
248+
use the projects
249+
`filetype <https://pypi.org/project/filetype/>`_,
250+
`puremagic <https://pypi.org/project/puremagic/>`_,
251+
or `python-magic <https://pypi.org/project/python-magic/>`_ instead.
252+
(Contributed by Victor Stinner in :gh:`104773`.)
253+
254+
247255
Porting to Python 3.13
248256
======================
249257

Diff for: Doc/whatsnew/3.5.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ Oberkirch in :issue:`21800`.)
12521252
imghdr
12531253
------
12541254

1255-
The :func:`~imghdr.what` function now recognizes the
1255+
The :func:`~!imghdr.what` function now recognizes the
12561256
`OpenEXR <https://www.openexr.com>`_ format
12571257
(contributed by Martin Vignali and Claudiu Popa in :issue:`20295`),
12581258
and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format

Diff for: Lib/imghdr.py

-180
This file was deleted.

Diff for: Lib/test/imghdrdata/python-raw.jpg

-525 Bytes
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.bmp

-1.13 KB
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.exr

-2.57 KB
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.jpg

-543 Bytes
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.pbm

-3
This file was deleted.

Diff for: Lib/test/imghdrdata/python.ras

-1.03 KB
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.sgi

-1.92 KB
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.tiff

-1.29 KB
Binary file not shown.

Diff for: Lib/test/imghdrdata/python.webp

-432 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)