File tree 1 file changed +10
-11
lines changed
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -485,25 +485,24 @@ Some details you should read once, but won't need to remember:
485
485
486
486
.. index :: single: ^ (caret); marker
487
487
488
- * For some :exc: ` SyntaxError ` \ s , Python displays the character position of the
489
- syntax error, using a `` ^ `` marker ::
488
+ * For some exceptions , Python displays the position of the error using `` ^ ``
489
+ markers and tildes ::
490
490
491
- >>> 1 1
491
+ >>> 1 + None
492
492
File "<stdin>", line 1
493
- 1 1
494
- ^
495
- SyntaxError: invalid syntax
493
+ 1 + None
494
+ ~~^~~~~~
495
+ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
496
496
497
497
Since the lines showing the position of the error come before the exception type
498
498
and detail, they are not checked by doctest. For example, the following test
499
499
would pass, even though it puts the ``^ `` marker in the wrong location::
500
500
501
- >>> 1 1
502
- Traceback (most recent call last):
501
+ >>> 1 + None
503
502
File "<stdin>", line 1
504
- 1 1
505
- ^
506
- SyntaxError: invalid syntax
503
+ 1 + None
504
+ ^~~~~~~~
505
+ TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
507
506
508
507
509
508
.. _option-flags-and-directives :
You can’t perform that action at this time.
0 commit comments