bpo-45132 Remove deprecated __getitem__ methods (GH-28225)

Remove deprecated __getitem__ methods of xml.dom.pulldom.DOMEventStream,
wsgiref.util.FileWrapper and fileinput.FileInput, deprecated since Python 3.9.
This commit is contained in:
Hugo van Kemenade 2021-09-08 13:07:40 +03:00 committed by GitHub
parent cb15afcccf
commit d003a5bd25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 34 additions and 139 deletions

View file

@ -257,21 +257,6 @@ class FileInput:
self.nextfile()
# repeat with next file
def __getitem__(self, i):
import warnings
warnings.warn(
"Support for indexing FileInput objects is deprecated. "
"Use iterator protocol instead.",
DeprecationWarning,
stacklevel=2
)
if i != self.lineno():
raise RuntimeError("accessing lines out of order")
try:
return self.__next__()
except StopIteration:
raise IndexError("end of input reached")
def nextfile(self):
savestdout = self._savestdout
self._savestdout = None