diff options
author | Brett Cannon <brett@python.org> | 2012-04-15 00:44:23 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-04-15 00:44:23 (GMT) |
commit | aef82d3d1ed9456fe973b667441849e53e1b7ba1 (patch) | |
tree | 31fdadf9776ea891abc53adee46956af6ca5d46d /Lib/idlelib | |
parent | 44590e47867e5a1943a6a197f188d8e82e8b3b56 (diff) | |
download | cpython-aef82d3d1ed9456fe973b667441849e53e1b7ba1.zip cpython-aef82d3d1ed9456fe973b667441849e53e1b7ba1.tar.gz cpython-aef82d3d1ed9456fe973b667441849e53e1b7ba1.tar.bz2 |
IDLE was relying on implicit relative imports which have gone away in
Python 3.3 thanks to importlib finishing the work in PEP 328 that
accidently got carried forward.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 6a01db0..de74e58 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1,8 +1,9 @@ -import sys +import imp +import importlib import os import re import string -import imp +import sys from tkinter import * import tkinter.simpledialog as tkSimpleDialog import tkinter.messagebox as tkMessageBox @@ -1005,7 +1006,10 @@ class EditorWindow(object): def load_extension(self, name): try: - mod = __import__(name, globals(), locals(), []) + try: + mod = importlib.import_module('.' + name, package=__package__) + except ImportError: + mod = importlib.import_module(name) except ImportError: print("\nFailed to import extension: ", name) raise |