diff options
-rw-r--r-- | Lib/importlib/__init__.py | 4 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index aab54a7..6732977 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -85,7 +85,9 @@ def import_module(name, package=None): level = 0 if name.startswith('.'): if not package: - raise TypeError("relative imports require the 'package' argument") + msg = ("the 'package' argument is required to perform a relative " + "import for {!r}") + raise TypeError(msg.format(name)) for character in name: if character != '.': break @@ -24,6 +24,9 @@ Core and Builtins Library ------- +- Issue #18598: Tweak exception message for importlib.import_module() to + include the module name when a key argument is missing. + - Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get docstrings and ValueError messages. Patch by Zhongyue Luo |