Skip to content

Commit 0933591

Browse files
committed
Add What's New
1 parent ae438a4 commit 0933591

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,24 @@ 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+
.. code-block:: shell-session
103+
104+
$ python random.py
105+
Traceback (most recent call last):
106+
File "/home/random.py", line 1, in <module>
107+
import random; print(random.randint(5))
108+
^^^^^^^^^^^^^
109+
File "/home/random.py", line 1, in <module>
110+
import random; print(random.randint(5))
111+
^^^^^^^^^^^^^^
112+
AttributeError: module 'random' has no attribute 'randint' (most likely due to '/home/random.py' shadowing the standard library module named 'random')
113+
114+
97115
Other Language Changes
98116
======================
99117

0 commit comments

Comments
 (0)