From 1e76e8643b00e6b8811aa4e5c6a7cedae829b9c0 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 25 Mar 2013 23:37:41 +0000 Subject: Issue #12718: Set importer on instance if Python function, to avoid bad interaction with winpdb. --- Lib/logging/config.py | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 37729d8..e2b0163 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -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): """ diff --git a/Misc/NEWS b/Misc/NEWS index cd2b2fc..016f5d7 100644 --- 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(). -- cgit v0.12