]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More has_key() fixes.
authorGuido van Rossum <guido@python.org>
Sat, 19 Aug 2006 16:09:41 +0000 (16:09 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 19 Aug 2006 16:09:41 +0000 (16:09 +0000)
The optparse fix is a fix to the previous fix, which broke has_option().

Lib/logging/__init__.py
Lib/optparse.py

index c65d07fc6b0f787ae6322831962c8f69f9a28ce0..1ef8f4405b604af55c84b6637763529a5733616b 100644 (file)
@@ -806,7 +806,7 @@ class PlaceHolder:
         Add the specified logger as a child of this placeholder.
         """
         #if alogger not in self.loggers:
-        if not self.loggerMap.has_key(alogger):
+        if alogger not in self.loggerMap:
             #self.loggers.append(alogger)
             self.loggerMap[alogger] = None
 
@@ -863,7 +863,7 @@ class Manager:
         rv = None
         _acquireLock()
         try:
-            if self.loggerDict.has_key(name):
+            if name in self.loggerDict:
                 rv = self.loggerDict[name]
                 if isinstance(rv, PlaceHolder):
                     ph = rv
@@ -891,7 +891,7 @@ class Manager:
         rv = None
         while (i > 0) and not rv:
             substr = name[:i]
-            if not self.loggerDict.has_key(substr):
+            if substr not in self.loggerDict:
                 self.loggerDict[substr] = PlaceHolder(alogger)
             else:
                 obj = self.loggerDict[substr]
index a02f79a098847fb0229928231a81ae0e88a9cbc8..0972f74bcce259c923e2d0dbfa4d200e2c55d1ac 100644 (file)
@@ -1040,7 +1040,7 @@ class OptionContainer:
 
     def has_option(self, opt_str):
         return (opt_str in self._short_opt or
-                opt_str) in self._long_opt
+                opt_str in self._long_opt)
 
     def remove_option(self, opt_str):
         option = self._short_opt.get(opt_str)