Message286929
Marco: I agree “Python reports an error” would have been simpler. That is what I meant to say. Anyway, perhaps we should put
Python raises :exc:`IndentationError` if mixed tabs and spaces are causing problems in leading whitespace.
In general, the exception seems to be IndentationError. TabError is a subclass, but is not raised in all circumstances. It seems the compiler assumes a particular tab model, so the exact exception depends on the amount of tabs and spaces:
>>> exec("if True:\n" + " "*8 + "1\n" "\t2\n")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 3
2
^
TabError: inconsistent use of tabs and spaces in indentation
>>> exec("if True:\n" + " "*9 + "1\n" "\t2\n")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 3
2
^
IndentationError: unindent does not match any outer indentation level |
|
| Date |
User |
Action |
Args |
| 2017-02-04 08:33:17 | martin.panter | set | recipients:
+ martin.panter, terry.reedy, paul.moore, tim.golden, docs@python, zach.ware, marco.buttu, steve.dower, xiang.zhang |
| 2017-02-04 08:33:17 | martin.panter | set | messageid: <[email protected]> |
| 2017-02-04 08:33:17 | martin.panter | link | issue29387 messages |
| 2017-02-04 08:33:17 | martin.panter | create | |
|