https://github.com/python/cpython/commit/9e5628ad68b768e2a8f0bcd3204b0027e238c45c
commit: 9e5628ad68b768e2a8f0bcd3204b0027e238c45c
branch: main
author: Sebastian Rittau <[email protected]>
committer: emmatyping <[email protected]>
date: 2025-11-02T13:56:59-08:00
summary:

gh-140808: Remove __class_getitem__ from mailbox._ProxyFile (#140838)

Co-authored-by: Emma Smith <[email protected]>

files:
A Misc/NEWS.d/next/Library/2025-10-31-16-25-13.gh-issue-140808.XBiQ4j.rst
M Lib/mailbox.py
M Lib/test/test_genericalias.py

diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index b00d9e8634c785..4a44642765cc9a 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -2090,8 +2090,6 @@ def closed(self):
             return False
         return self._file.closed
 
-    __class_getitem__ = classmethod(GenericAlias)
-
 
 class _PartialFile(_ProxyFile):
     """A read-only wrapper of part of a file."""
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index 4e08adaca05cdd..9df9296e26ad5c 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -17,7 +17,7 @@
 from functools import partial, partialmethod, cached_property
 from graphlib import TopologicalSorter
 from logging import LoggerAdapter, StreamHandler
-from mailbox import Mailbox, _PartialFile
+from mailbox import Mailbox
 try:
     import ctypes
 except ImportError:
@@ -117,7 +117,7 @@ class BaseTest(unittest.TestCase):
                      Iterable, Iterator,
                      Reversible,
                      Container, Collection,
-                     Mailbox, _PartialFile,
+                     Mailbox,
                      ContextVar, Token,
                      Field,
                      Set, MutableSet,
diff --git 
a/Misc/NEWS.d/next/Library/2025-10-31-16-25-13.gh-issue-140808.XBiQ4j.rst 
b/Misc/NEWS.d/next/Library/2025-10-31-16-25-13.gh-issue-140808.XBiQ4j.rst
new file mode 100644
index 00000000000000..090f39c6e25fdf
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-10-31-16-25-13.gh-issue-140808.XBiQ4j.rst
@@ -0,0 +1 @@
+The internal class ``mailbox._ProxyFile`` is no longer a parameterized generic.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to