Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30eee4d

Browse files
committed
Issue #28815: Change '?' to '<module>' in some doc examples.
Patch by Mariatta Wijaya.
1 parent e3c65a7 commit 30eee4d

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

Doc/tutorial/errors.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Syntax errors, also known as parsing errors, are perhaps the most common kind of
1818
complaint you get while you are still learning Python::
1919

2020
>>> while True print('Hello world')
21-
File "<stdin>", line 1, in ?
21+
File "<stdin>", line 1
2222
while True print('Hello world')
2323
^
2424
SyntaxError: invalid syntax
@@ -44,15 +44,15 @@ programs, however, and result in error messages as shown here::
4444

4545
>>> 10 * (1/0)
4646
Traceback (most recent call last):
47-
File "<stdin>", line 1, in ?
47+
File "<stdin>", line 1, in <module>
4848
ZeroDivisionError: division by zero
4949
>>> 4 + spam*3
5050
Traceback (most recent call last):
51-
File "<stdin>", line 1, in ?
51+
File "<stdin>", line 1, in <module>
5252
NameError: name 'spam' is not defined
5353
>>> '2' + 2
5454
Traceback (most recent call last):
55-
File "<stdin>", line 1, in ?
55+
File "<stdin>", line 1, in <module>
5656
TypeError: Can't convert 'int' object to str implicitly
5757

5858
The last line of the error message indicates what happened. Exceptions come in
@@ -214,7 +214,7 @@ exception to occur. For example::
214214

215215
>>> raise NameError('HiThere')
216216
Traceback (most recent call last):
217-
File "<stdin>", line 1, in ?
217+
File "<stdin>", line 1, in <module>
218218
NameError: HiThere
219219

220220
The sole argument to :keyword:`raise` indicates the exception to be raised.
@@ -233,7 +233,7 @@ re-raise the exception::
233233
...
234234
An exception flew by!
235235
Traceback (most recent call last):
236-
File "<stdin>", line 2, in ?
236+
File "<stdin>", line 2, in <module>
237237
NameError: HiThere
238238

239239

@@ -308,7 +308,7 @@ example::
308308
...
309309
Goodbye, world!
310310
Traceback (most recent call last):
311-
File "<stdin>", line 2, in ?
311+
File "<stdin>", line 2, in <module>
312312
KeyboardInterrupt
313313

314314
A *finally clause* is always executed before leaving the :keyword:`try`
@@ -340,7 +340,7 @@ complicated example::
340340
>>> divide("2", "1")
341341
executing finally clause
342342
Traceback (most recent call last):
343-
File "<stdin>", line 1, in ?
343+
File "<stdin>", line 1, in <module>
344344
File "<stdin>", line 3, in divide
345345
TypeError: unsupported operand type(s) for /: 'str' and 'str'
346346

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ Truida Wiedijk
15951595
Felix Wiemann
15961596
Gerry Wiener
15971597
Frank Wierzbicki
1598+
Mariatta Wijaya
15981599
Santoso Wijaya
15991600
Chris Wilcox
16001601
Bryce "Zooko" Wilcox-O'Hearn

0 commit comments

Comments
 (0)