Skip to content
Myr

importlib deprecated in 3.5.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Replace the use of importlib by types.ModuleType that seem to be available since at least 2.6 closes gh-1449

authored by Matthias Bussonnier · committed by Matthias Bussonnier · parent 73c8335 · Browse files · 2 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−4 removed

  • other:+4 added−4 removed

2 files+4 added−4 removed

modified:flask/config.py+2 added-2 removed
7 unmodified lines
8 :copyright: (c) 2015 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10"""1112import imp12import os13import types14import errno1516from werkzeug.utils import import_string17from ._compat import string_types, iteritems
104 unmodified lines
122 .. versionadded:: 0.7123 `silent` parameter.124 """125 filename = os.path.join(self.root_path, filename)126 d = imp.new_module('config')126 d = types.ModuleType('config')127 d.__file__ = filename128 try:129 with open(filename) as config_file:130 exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
128 unmodified lines
modified:scripts/flaskext_compat.py+2 added-2 removed
13 unmodified lines
1415 :copyright: (c) 2015 by Armin Ronacher.16 :license: BSD, see LICENSE for more details.17"""18import types19import sys20import os20import imp212223class ExtensionImporter(object):24 """This importer redirects imports from this submodule to other locations.
92 unmodified lines
117118119def activate():120 import flask121 ext_module = imp.new_module('flask.ext')121 ext_module = types.ModuleType('flask.ext')122 ext_module.__path__ = []123 flask.ext = sys.modules['flask.ext'] = ext_module124 importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], 'flask.ext')125 importer.install()