Skip to content

Commit f76457e

Browse files
committed
Issue #26844: Fix imp.find_module() to have the exception related to
type issues be about 'path' instead of 'name'. Thanks to Lev Maximov for the patch.
1 parent 5d9c7ed commit f76457e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Lib/imp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ def find_module(name, path=None):
266266
raise TypeError("'name' must be a str, not {}".format(type(name)))
267267
elif not isinstance(path, (type(None), list)):
268268
# Backwards-compatibility
269-
raise RuntimeError("'list' must be None or a list, "
270-
"not {}".format(type(name)))
269+
raise RuntimeError("'path' must be None or a list, "
270+
"not {}".format(type(path)))
271271

272272
if path is None:
273273
if is_builtin(name):

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ Graham Matthews
939939
mattip
940940
Martin Matusiak
941941
Dieter Maurer
942+
Lev Maximov
942943
Daniel May
943944
Madison May
944945
Lucas Maystre

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Core and Builtins
2222
Library
2323
-------
2424

25+
- Issue #26844: Fix error message for imp.find_module() to refer to 'path'
26+
instead of 'name'. Patch by Lev Maximov.
27+
2528
- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise
2629
an error about unclean EOF.
2730

0 commit comments

Comments
 (0)