File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,21 @@ Improved Error Messages
94
94
variables. See also :ref: `using-on-controlling-color `.
95
95
(Contributed by Pablo Galindo Salgado in :gh: `112730 `.)
96
96
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
+
97
112
Other Language Changes
98
113
======================
99
114
You can’t perform that action at this time.
0 commit comments