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.

Author pitrou
Recipients brett.cannon, cheryl.sabella, eric.snow, ncoghlan, piscvau@yahoo.fr, pitrou, ppperry, taleinat, terry.reedy, xtreak
Date 2018-09-29.10:24:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538216697.95.0.545547206417.issue34609@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2018-09-29 10:24:57pitrousetrecipients: + pitrou, brett.cannon, terry.reedy, ncoghlan, taleinat, eric.snow, ppperry, cheryl.sabella, xtreak, piscvau@yahoo.fr
2018-09-29 10:24:57pitrousetmessageid: <1538216697.95.0.545547206417.issue34609@psf.upfronthosting.co.za>
2018-09-29 10:24:57pitroulinkissue34609 messages
2018-09-29 10:24:57pitroucreate