[issue42570] Try and Except doesn't work properly

Kshitish report at bugs.python.org
Sat Dec 5 01:32:56 EST 2020


Kshitish <nishantgautam930 at gmail.com> added the comment:

for i in range(1,11):
    try:
        if i == i:
            print(i)
            if i == 5:
                continue
                print(i,'poc')
    except:
        print("Out")

Output:

1
2
3
4
5
6
7
8
9
10


As you can see the continue keyword is not working. The out put should be like that:

1
2
3
4
6
7
9
10

But it is not and this is the bug because every keyword must work as their task. if they they not then may be the code will be affected by this vulnerability. 

Thank you

----------
status: closed -> open
Added file: https://bugs.python.org/file49657/main.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42570>
_______________________________________


More information about the Python-bugs-list mailing list