[Python-checkins] r65508 - in python/trunk/Lib/xml/sax: __init__.py xmlreader.py

brett.cannon python-checkins at python.org
Mon Aug 4 23:10:50 CEST 2008


Author: brett.cannon
Date: Mon Aug  4 23:10:50 2008
New Revision: 65508

Log:
Remove dict.has_key() usage in xml.sax to silence warnings under -3.


Modified:
   python/trunk/Lib/xml/sax/__init__.py
   python/trunk/Lib/xml/sax/xmlreader.py

Modified: python/trunk/Lib/xml/sax/__init__.py
==============================================================================
--- python/trunk/Lib/xml/sax/__init__.py	(original)
+++ python/trunk/Lib/xml/sax/__init__.py	Mon Aug  4 23:10:50 2008
@@ -81,7 +81,7 @@
             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

Modified: python/trunk/Lib/xml/sax/xmlreader.py
==============================================================================
--- python/trunk/Lib/xml/sax/xmlreader.py	(original)
+++ python/trunk/Lib/xml/sax/xmlreader.py	Mon Aug  4 23:10:50 2008
@@ -294,12 +294,12 @@
         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 @@
         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)


More information about the Python-checkins mailing list