[Python-checkins] cpython (2.7): Issue #12718: Set importer on instance if Python function, to avoid bad

vinay.sajip python-checkins at python.org
Tue Mar 26 00:38:44 CET 2013


http://hg.python.org/cpython/rev/e35eafc872cd
changeset: 82955:e35eafc872cd
branch: 2.7
parent: 82951:6fc9103d55f0
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Mon Mar 25 23:37:41 2013 +0000
summary:
 Issue #12718: Set importer on instance if Python function, to avoid bad interaction with winpdb.
files:
 Lib/logging/config.py | 6 ++++++
 Misc/NEWS | 3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -379,6 +379,12 @@
 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):
 """
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -247,6 +247,9 @@
 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().
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /