From 2de525c720bea58c088decedd89bab5914e39a7e Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Fri, 1 May 2015 17:30:20 -0700 Subject: [PATCH] importlib deprecated in 3.5. Replace the use of importlib by types.ModuleType that seem to be available since at least 2.6 closes gh-1449 --- flask/config.py | 4 ++-- scripts/flaskext_compat.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flask/config.py b/flask/config.py index 0f7b5eba..d2eeb837 100644 --- a/flask/config.py +++ b/flask/config.py @@ -9,8 +9,8 @@ :license: BSD, see LICENSE for more details. """ -import imp import os +import types import errno from werkzeug.utils import import_string @@ -123,7 +123,7 @@ class Config(dict): `silent` parameter. """ filename = os.path.join(self.root_path, filename) - d = imp.new_module('config') + d = types.ModuleType('config') d.__file__ = filename try: with open(filename) as config_file: diff --git a/scripts/flaskext_compat.py b/scripts/flaskext_compat.py index 3784936c..77d38c20 100644 --- a/scripts/flaskext_compat.py +++ b/scripts/flaskext_compat.py @@ -15,9 +15,9 @@ :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ +import types import sys import os -import imp class ExtensionImporter(object): @@ -118,7 +118,7 @@ class ExtensionImporter(object): def activate(): import flask - ext_module = imp.new_module('flask.ext') + ext_module = types.ModuleType('flask.ext') ext_module.__path__ = [] flask.ext = sys.modules['flask.ext'] = ext_module importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], 'flask.ext')