[issue34609] Importing certain modules while debugging raises an exception

2018-09-29 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I think pperry nailed it above:

> Pdb fails because it is attempting to import the readline module every time 
> its `trace_dispatch` is called, and the import implementation is not 
> reentrant in that way.

More precisely, _ModuleLock.acquire() in 
https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap.py#L101 
is not reentrant.  If pdb steps into that function and tries to call it again 
by making an "import" call, `_blocking_on[tid]` will be overwritten and then 
deleted inside the nested call, so `del _blocking_on` in the enclosing call 
will raise a KeyError.

I think the solution would be either one of:
1) pdb avoids doing anything import-related as part of its step function
2) pdb avoids stepping inside importlib internals (e.g. by blacklisting 
importlib modules)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-28 Thread Brett Cannon


Brett Cannon  added the comment:

The failure line that Cheryl found in her traceback is at 
https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap.py#L101 .

Maybe Antoine has an idea since he did a bunch of work on import locking?

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The IDLE issue here is a duplicate of #33065, where the OP said that only step, 
not go, created the problem.  ppperry, thank you for the solution.

Cheryl, please open a new issue for the pdb bug with a little more detail and 
ppperry's comment.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE debugger: problem importing user created module

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-23 Thread ppperry


ppperry  added the comment:

The Pdb bug and the IDLE bug are unrelated to each other:

   Pdb fails because it is attempting to import the readline module every time 
its `trace_dispatch` is called, and the import implementation is not reentrant 
in that way.

   IDLE is crashing because the uninitialized _ModuleLock instance raised an 
error when `repr` is called, and the IDLE debugger lacks code to catch that 
exception.

--
nosy: +ppperry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
assignee: terry.reedy -> 
components:  -IDLE

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34609] Importing certain modules while debugging raises an exception

2018-09-22 Thread Tal Einat


Change by Tal Einat :


--
title: Importing the certain modules while debugging raises an exception -> 
Importing certain modules while debugging raises an exception

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com