mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-9372: Deprecate several __getitem__ methods (GH-8609)
The __getitem__ methods of DOMEventStream, FileInput, and FileWrapper classes ignore their 'index' parameters and return the next item instead.
This commit is contained in:
parent
423d05f6f5
commit
84a13fbda0
12 changed files with 82 additions and 0 deletions
|
|
@ -18,6 +18,13 @@ class FileWrapper:
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue