Skip to content

Commit 336a722

Browse files
committed
alyssa review
1 parent 79ab582 commit 336a722

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Improved error messages
274274
File "/home/me/random.py", line 3, in <module>
275275
print(random.randint(5))
276276
^^^^^^^^^^^^^^
277-
AttributeError: module 'random' has no attribute 'randint' (consider renaming '/home/me/random.py' since it has the same name as the standard library module named 'random' and the import system gives it precedence)
277+
AttributeError: module 'random' has no attribute 'randint' (consider renaming '/home/me/random.py' since it has the same name as the standard library module named 'random' and prevents importing that standard library module)
278278
279279
Similarly, if a script has the same name as a third-party
280280
module that it attempts to import and this results in errors,

Lib/test/test_import/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def test_script_shadowing_stdlib(self):
822822
expected_error = error + (
823823
rb" \(consider renaming '.*fractions.py' since it has the "
824824
rb"same name as the standard library module named 'fractions' "
825-
rb"and the import system gives it precedence\)"
825+
rb"and prevents importing that standard library module\)"
826826
)
827827

828828
popen = script_helper.spawn_python(os.path.join(tmp, "fractions.py"), cwd=tmp)
@@ -883,7 +883,7 @@ def test_package_shadowing_stdlib_module(self):
883883
expected_error = error + (
884884
rb" \(consider renaming '.*[\\/]fractions[\\/]+__init__.py' since it has the "
885885
rb"same name as the standard library module named 'fractions' "
886-
rb"and the import system gives it precedence\)"
886+
rb"and prevents importing that standard library module\)"
887887
)
888888

889889
popen = script_helper.spawn_python(os.path.join(tmp, "main.py"), cwd=tmp)
@@ -1122,7 +1122,7 @@ def test_script_shadowing_stdlib_sys_path_modification(self):
11221122
expected_error = error + (
11231123
rb" \(consider renaming '.*fractions.py' since it has the "
11241124
rb"same name as the standard library module named 'fractions' "
1125-
rb"and the import system gives it precedence\)"
1125+
rb"and prevents importing that standard library module\)"
11261126
)
11271127

11281128
popen = script_helper.spawn_python("main.py", cwd=tmp)

Objects/moduleobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ _Py_module_getattro_impl(PyModuleObject *m, PyObject *name, int suppress)
10171017
"module '%U' has no attribute '%U' "
10181018
"(consider renaming '%U' since it has the same "
10191019
"name as the standard library module named '%U' "
1020-
"and the import system gives it precedence)",
1020+
"and prevents importing that standard library module)",
10211021
mod_name, name, origin, mod_name);
10221022
}
10231023
else {

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,7 +2873,7 @@ _PyEval_ImportFrom(PyThreadState *tstate, PyObject *v, PyObject *name)
28732873
"cannot import name %R from %R "
28742874
"(consider renaming %R since it has the same "
28752875
"name as the standard library module named %R "
2876-
"and the import system gives it precedence)",
2876+
"and prevents importing that standard library module)",
28772877
name, mod_name_or_unknown, origin, mod_name_or_unknown
28782878
);
28792879
}

0 commit comments

Comments
 (0)