[New-bugs-announce] [issue38640] while False: break => SyntaxError: 'break' outside loop
Hugo Dupras
report at bugs.python.org
Wed Oct 30 05:48:06 EDT 2019
New submission from Hugo Dupras <jabesq at gmail.com>:
In python 3.8 the following code raises an exception, which was not the case with previous python.
```
while False:
...
break
```
It raises the following exception: SyntaxError: 'break' outside loop.
This `while False` loop was used to temporary disable a while loop in our code base.
Workaround to fix this:
```
enable=False
while enable:
...
break
``` (or use the walrus operator)
----------
components: Interpreter Core
messages: 355700
nosy: jabesq
priority: normal
severity: normal
status: open
title: while False: break => SyntaxError: 'break' outside loop
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38640>
_______________________________________
More information about the New-bugs-announce
mailing list