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.
diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py
index 43504f7..96a8d59 100644
--- a/Lib/xml/dom/pulldom.py
+++ b/Lib/xml/dom/pulldom.py
@@ -217,6 +217,13 @@
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