Terry J. Reedy added the comment:

With Python 3.4.1, Win 7, there is a detour stepping through displayhook before 
arriving at the same place with the same result upon quitting. If one does not 
quit, stepping ends at

> c:\programs\python34\lib\threading.py(235)__enter__()
-> return self._lock.__enter__()
(Pdb) s
--Return--
s <no response>
---------------

With respect to b, the exception, this seems to be a duplicate, and I am 
inclined to close this issue as such.

With respect to a, not stopping, this is not a bug, at least not one involving 
Idle. Idle executes code within an exec call within a call of the runcode 
method of the Executive class. In a similar circumstance, the console 
interpreter does not stop either. So I have removed Idle from the title and 
components.

A direct exec is semi-problemmatical. 

>>> import pdb
>>> def do(): pdb.set_trace()
...
>>> exec('do()', locals())
--Return--
> <stdin>(1)do()->None
(Pdb) s
--Return--
> <string>(1)<module>()->None
(Pdb) s
--Return--
> <stdin>(1)<module>()->None
(Pdb) s

# This returns to a '>>>' prompt,

>>> def run(): exec('do()', locals())

# but hitting <return> after this line returns us to the debugger.

--Call--
> c:\programs\python34\lib\encodings\cp437.py(14)decode()
-> def decode(self,input,errors='strict'):
(Pdb)
> c:\programs\python34\lib\encodings\cp437.py(15)decode()
-> return codecs.charmap_decode(input,errors,decoding_table)
(Pdb) q
  File "<stdin>", line 0

    ^
SyntaxError: decoding with 'cp437' codec failed (BdbQuit: )

# Now we are really out.

>>> run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'run' is not defined

# the def statement did not execute

>>> def run(): exec('do()', globals())
...
>>> run()

# and now the behavior is as reported for Idle

--Return--
> <stdin>(1)do()->None
s

# about 20 steps later, still going.

s
> c:\programs\python34\lib\encodings\cp437.py(19)encode()
-> return codecs.charmap_encode(input,self.errors,encoding_map)[0]
---------------------------------------------

I know very little about the pdb spec and do not know whether the above is a(n 
unreported) python or pdb bug or not. If any of you think it is, say so. 
Otherwise this should be closed.

----------
components:  -IDLE
stage:  -> resolved
superseder:  -> pdb raises BdbQuit on 'quit' when started with set_trace
title: Pdb.set_trace debugging does not end correctly in IDLE -> Pdb.set_trace 
debugging does not end correctly
versions: +Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21997>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to