File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,21 @@ Improved Error Messages
9494 variables. See also :ref: `using-on-controlling-color `.
9595 (Contributed by Pablo Galindo Salgado in :gh: `112730 `.)
9696
97+ * A common mistake is to write a script with the same name as a
98+ standard library module. The interpreter now detects this and
99+ displays a more helpful error message.
100+ (Contributed by Shantanu Jain in :gh: `95754 `.)
101+
102+ $ python random.py
103+ Traceback (most recent call last):
104+ File "/home/random.py", line 1, in <module>
105+ import random; print(random.randint(5))
106+ ^^^^^^^^^^^^^
107+ File "/home/random.py", line 1, in <module>
108+ import random; print(random.randint(5))
109+ ^^^^^^^^^^^^^^
110+ AttributeError: module 'random' has no attribute 'randint' (most likely due to '/home/random.py' shadowing the standard library module named 'random')
111+
97112Other Language Changes
98113======================
99114
You can’t perform that action at this time.
0 commit comments