]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-140808: Remove __class_getitem__ from mailbox._ProxyFile (#140838)
authorSebastian Rittau <srittau@rittau.biz>
Sun, 2 Nov 2025 21:56:59 +0000 (22:56 +0100)
committerGitHub <noreply@github.com>
Sun, 2 Nov 2025 21:56:59 +0000 (13:56 -0800)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Lib/mailbox.py
Lib/test/test_genericalias.py
Misc/NEWS.d/next/Library/2025-10-31-16-25-13.gh-issue-140808.XBiQ4j.rst [new file with mode: 0644]

index b00d9e8634c785326592f22f9f8dedc01d5ea100..4a44642765cc9a434604ff366b727410c5cb4193 100644 (file)
@@ -2090,8 +2090,6 @@ class _ProxyFile:
             return False
         return self._file.closed
 
-    __class_getitem__ = classmethod(GenericAlias)
-
 
 class _PartialFile(_ProxyFile):
     """A read-only wrapper of part of a file."""
index 4e08adaca05cdd41a91e97293447bb4c5edd1749..9df9296e26ad5c9147cf6fb8a295e49926342ef5 100644 (file)
@@ -17,7 +17,7 @@ from dataclasses import Field
 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 (file)
index 0000000..090f39c
--- /dev/null
@@ -0,0 +1 @@
+The internal class ``mailbox._ProxyFile`` is no longer a parameterized generic.