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: Python debugger ignores exception if instructed to return from generator
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, georg.brandl, inducer
Priority: normal Keywords:

Created on 2009-06-08 23:06 by inducer, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pdb_bug.py inducer, 2009-06-08 23:06
Messages (3)
msg89123 - (view) Author: Andreas Kloeckner (inducer) Date: 2009-06-08 23:06
I get this debugger session with the attached file. Note that even
though a NameError occurs, no indication of that error is visible on the
debugger conosle.
8< -----------------------------------------------------------------
$ python -m pdb pdb_bug.py
> /home/andreas/tmp/pdb_bug.py(1)<module>()
-> def f():
(Pdb) n
> /home/andreas/tmp/pdb_bug.py(6)<module>()
-> list(f())
(Pdb) s
--Call--
> /home/andreas/tmp/pdb_bug.py(1)f()
-> def f():
(Pdb) n
> /home/andreas/tmp/pdb_bug.py(2)f()
-> print "BLAH"
(Pdb) r
BLAH
--Return--
> /home/andreas/tmp/pdb_bug.py(3)f()->None
-> bogus
(Pdb)
msg109899 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-10 17:38
I can reproduce this on Windows Vista.
msg112087 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-30 16:14
This is no special behavior with generators.  If you remove the "yield" statement, you will get similar output with the exception bubbling up the stack.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50495
2010-07-30 16:14:44georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg112087

resolution: works for me
2010-07-10 17:38:17BreamoreBoysetnosy: + BreamoreBoy

messages: + msg109899
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.5
2009-06-08 23:51:33inducersettitle: Python bebugger ignores exception if instructed to return from generator -> Python debugger ignores exception if instructed to return from generator
2009-06-08 23:06:40inducercreate