diff options
| author | Brett Cannon <brett@python.org> | 2021-03-30 08:43:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-30 08:43:03 -0700 |
| commit | a7ff6df60c05e1b69fca743573b1e118bebf121d (patch) | |
| tree | 7dae896ba674245645b5ca46c02cc387a43d35a0 /Lib/importlib/_bootstrap.py | |
| parent | cf35e05f89bb008d6f4553f9875e0fe87fc02406 (diff) | |
| download | cpython-git-a7ff6df60c05e1b69fca743573b1e118bebf121d.tar.gz | |
bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044)
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
| -rw-r--r-- | Lib/importlib/_bootstrap.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index d5acb6545f..ab52e778fd 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -903,8 +903,9 @@ def _resolve_name(name, package, level): def _find_spec_legacy(finder, name, path): - # This would be a good place for a DeprecationWarning if - # we ended up going that route. + msg = (f"{_object_name(finder)}.find_spec() not found; " + "falling back to find_module()") + _warnings.warn(msg, ImportWarning) loader = finder.find_module(name, path) if loader is None: return None |
