mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +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
|
@ -17,19 +17,6 @@ class FileWrapper:
|
|||
if hasattr(filelike,'close'):
|
||||
self.close = filelike.close
|
||||
|
||||
def __getitem__(self,key):
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"FileWrapper's __getitem__ method ignores 'key' parameter. "
|
||||
"Use iterator protocol instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
data = self.filelike.read(self.blksize)
|
||||
if data:
|
||||
return data
|
||||
raise IndexError
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue