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:
Berker Peksag 2018-08-11 09:05:04 +03:00 committed by GitHub
parent 423d05f6f5
commit 84a13fbda0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 82 additions and 0 deletions

View file

@ -217,6 +217,13 @@ class DOMEventStream:
self.parser.setContentHandler(self.pulldom)
def __getitem__(self, pos):
import warnings
warnings.warn(
"DOMEventStream's __getitem__ method ignores 'pos' parameter. "
"Use iterator protocol instead.",
DeprecationWarning,
stacklevel=2
)
rc = self.getEvent()
if rc:
return rc