]> granicus.if.org Git - python/commitdiff
Issue #12718: Set importer on instance if Python function, to avoid bad interaction...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 25 Mar 2013 23:37:41 +0000 (23:37 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 25 Mar 2013 23:37:41 +0000 (23:37 +0000)
Lib/logging/config.py
Misc/NEWS

index 37729d8983e294ac27ce2ab941e63f2393c69c44..e2b0163e870e10aa7fbb60ecc5ce08683409ebe3 100644 (file)
@@ -379,6 +379,12 @@ class BaseConfigurator(object):
     def __init__(self, config):
         self.config = ConvertingDict(config)
         self.config.configurator = self
+        # Issue 12718: winpdb replaces __import__ with a Python function, which
+        # ends up being treated as a bound method. To avoid problems, we
+        # set the importer on the instance, but leave it defined in the class
+        # so existing code doesn't break
+        if type(__import__) == types.FunctionType:
+            self.importer = __import__
 
     def resolve(self, s):
         """
index cd2b2fc9889352ebdff7e4c56f099a7c13eb3d55..016f5d73246610fbafc5b4ba51921e5a1b080a89 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -247,6 +247,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #12718: Fix interaction with winpdb overriding __import__ by setting
+  importer attribute on BaseConfigurator instance.
+  
 - Issue #17521: Corrected non-enabling of logger following two calls to
   fileConfig().