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: Statements in try block still executes after raised error
Type: behavior Stage: resolved
Components: Documentation, Interpreter Core, Windows Versions: Python 3.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Torbjørn Wikestad, docs@python, paul.moore, steve.dower, steven.daprano, tim.golden, xtreak, zach.ware
Priority: normal Keywords:

Created on 2019-11-12 09:48 by Torbjørn Wikestad, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
2019-11-12_try-clause,numpy,random,copy,time,ipython,spyder,python36.py Torbjørn Wikestad, 2019-11-12 16:29
Messages (5)
msg356429 - (view) Author: Torbjørn Wikestad (Torbjørn Wikestad) Date: 2019-11-12 09:48
In a script that runs in a IPython 3.6 console (Spyder IDE, part of a WinPython bundle), a counter increment statement is executed after a function call which raises an ValueError exception in try ... except structure. This does not seem to be the correct interpreter behavior, from the resources that I found, as the expected behaviour is said for execution to jump directly to the except block.
msg356438 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-11-12 11:01
Can you please add the script without any dependencies to reproduce this?
msg356458 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2019-11-12 14:09
Please try your script in the vanilla Python interpreter. If it behaves correctly, you should report this issue to Spyder and/or IPython.
msg356471 - (view) Author: Torbjørn Wikestad (Torbjørn Wikestad) Date: 2019-11-12 16:29
The script has been tried and found to work as intended in the Idle IDE, which runs on a standard win32 python shell. So the error is linked only with IPython or Spyder.
msg356472 - (view) Author: Torbjørn Wikestad (Torbjørn Wikestad) Date: 2019-11-12 16:34
I could not reproduce the error when I open the script in Spyder anew.
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 82955
2019-11-12 16:34:57Torbjørn Wikestadsetstatus: open -> closed
resolution: works for me
messages: + msg356472

stage: resolved
2019-11-12 16:29:04Torbjørn Wikestadsetfiles: + 2019-11-12_try-clause,numpy,random,copy,time,ipython,spyder,python36.py

messages: + msg356471
2019-11-12 14:09:51steven.dapranosetnosy: + steven.daprano
messages: + msg356458
2019-11-12 11:01:32xtreaksetnosy: + xtreak
messages: + msg356438
2019-11-12 09:48:10Torbjørn Wikestadcreate