This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Try and Except doesn't work properly
Type: behavior Stage: resolved
Components: Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: blue555, eric.smith, rhettinger, steven.daprano
Priority: normal Keywords:

Created on 2020-12-04 17:53 by blue555, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
main.py blue555, 2020-12-04 17:53 At try and except the continue keyword doesn't work probably
poc.py blue555, 2020-12-05 06:32
Messages (5)
msg382515 - (view) Author: Kshitish (blue555) Date: 2020-12-04 17:53
Try & Except doesn't work probably. 
In the except continue keyword doesn't work probably.
msg382517 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-04 17:57
You've not said what happens, nor what you're expecting to happen, so we cannot help you.
msg382532 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-12-04 21:36
Code is working correctly, not a bug. Perhaps you are mistaking `continue` for `break`.

Kshitish, we keep telling you not to use the bug tracker as a help desk. This is now your eighth "bug report" that was 100% your misunderstanding. There are many other resources where you can ask for help:

https://mail.python.org/mailman/listinfo/tutor

https://www.reddit.com/r/learnpython/

are good places to start. There are many others, which we have already suggested to you in previous issues. Please stop wasting our time.
msg382556 - (view) Author: Kshitish (blue555) Date: 2020-12-05 06:32
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
msg382558 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-12-05 06:50
Kshitish, it was inappropriate to reopen this issue.  This forum is for tracking actual bugs in Python as opposed to bugs in a user's understanding of Python.  My suggestion is that you post on StackOverflow so that the helpers there can explain what is going on with the posted example.
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86736
2020-12-05 06:50:52rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg382558

resolution: works for me -> not a bug
2020-12-05 06:32:56blue555setstatus: closed -> open
files: + poc.py
messages: + msg382556
2020-12-04 21:36:33steven.dapranosetstatus: open -> closed

nosy: + steven.daprano
messages: + msg382532

resolution: works for me
stage: resolved
2020-12-04 17:57:00eric.smithsetnosy: + eric.smith
messages: + msg382517
2020-12-04 17:53:40blue555create