[issue16596] Skip stack unwinding when "next", "until" and "return" pdb commands executed in generator context

Guido van Rossum report at bugs.python.org
Tue Nov 19 22:21:13 CET 2013


Guido van Rossum added the comment:

It's not fixed.  Let me paste in a session.  This uses the latest Tulip repo (simple_tcp_server.py was just added).  I've added "import pdb; pdb.set_trace()" to the top of the client() coroutine, to set a breakpoint (I'm a very unsophisticated pdb user :-).  I step over a yield-from, great.  Then I step into recv().  Note the final 'n' command.  This is at the return statement in recv().  At this point I expect to go back into the client() coroutine, but somehow the debugger loses control and the program finishes execution without giving control back.

bash-3.2$ ~/cpython/python.exe -m examples.simple_tcp_server
~/cpython/python.exe -m examples.simple_tcp_server
> /Users/guido/tulip/examples/simple_tcp_server.py(119)client()
-> reader, writer = yield from asyncio.streams.open_connection(
(Pdb) n
n
> /Users/guido/tulip/examples/simple_tcp_server.py(120)client()
-> '127.0.0.1', 12345, loop=loop)
(Pdb) 

> /Users/guido/tulip/examples/simple_tcp_server.py(122)client()
-> def send(msg):
(Pdb) 

> /Users/guido/tulip/examples/simple_tcp_server.py(126)client()
-> def recv():
(Pdb) 

> /Users/guido/tulip/examples/simple_tcp_server.py(132)client()
-> send("add 1 2")
(Pdb) 

> add 1 2
> /Users/guido/tulip/examples/simple_tcp_server.py(133)client()
-> msg = yield from recv()
(Pdb) s
s
--Call--
> /Users/guido/tulip/examples/simple_tcp_server.py(126)recv()
-> def recv():
(Pdb) n
n
> /Users/guido/tulip/examples/simple_tcp_server.py(127)recv()
-> msgback = (yield from reader.readline()).decode("utf-8").rstrip()
(Pdb) n
n
> /Users/guido/tulip/examples/simple_tcp_server.py(128)recv()
-> print("< " + msgback)
(Pdb) n
n
< 3.0
> /Users/guido/tulip/examples/simple_tcp_server.py(129)recv()
-> return msgback
(Pdb) n
n
> repeat 5 hello
< begin
< 1. hello
< 2. hello
< 3. hello
< 4. hello
< 5. hello
< end
client task done: Task(<_handle_client>)<result=None>
bash-3.2$

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16596>
_______________________________________


More information about the Python-bugs-list mailing list