From 5b3d3729baada9e8913a2f8556bbe041834c1b17 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 4 Aug 2008 21:10:50 +0000 Subject: [PATCH] Remove dict.has_key() usage in xml.sax to silence warnings under -3. --- Lib/xml/sax/__init__.py | 2 +- Lib/xml/sax/xmlreader.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/xml/sax/__init__.py b/Lib/xml/sax/__init__.py index 6b1b1ba0071..73ec9291ab9 100644 --- a/Lib/xml/sax/__init__.py +++ b/Lib/xml/sax/__init__.py @@ -81,7 +81,7 @@ def make_parser(parser_list = []): return _create_parser(parser_name) except ImportError,e: import sys - if sys.modules.has_key(parser_name): + if parser_name in sys.modules: # The parser module was found, but importing it # failed unexpectedly, pass this exception through raise diff --git a/Lib/xml/sax/xmlreader.py b/Lib/xml/sax/xmlreader.py index 9a2361e349d..8e230841f69 100644 --- a/Lib/xml/sax/xmlreader.py +++ b/Lib/xml/sax/xmlreader.py @@ -294,12 +294,12 @@ class AttributesImpl: return self._attrs[name] def getNameByQName(self, name): - if not self._attrs.has_key(name): + if not name in self._attrs: raise KeyError, name return name def getQNameByName(self, name): - if not self._attrs.has_key(name): + if not name in self._attrs: raise KeyError, name return name @@ -319,7 +319,7 @@ class AttributesImpl: return self._attrs.keys() def has_key(self, name): - return self._attrs.has_key(name) + return name in self._attrs def __contains__(self, name): return self._attrs.has_key(name)