mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
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:
parent
cb15afcccf
commit
d003a5bd25
11 changed files with 34 additions and 139 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue