[issue20703] RuntimeError caused by lazy imports in pdb
Eric Snow
report at bugs.python.org
Thu Feb 26 16:31:07 CET 2015
Eric Snow added the comment:
I haven't looked to closely but I'm guessing that pdb.set_trace() causes something to get imported (i.e. there's an import statement in a function body somewhere). Consequently sys.modules is updated (by that "distant" import statement) while you are iterating over it here.
In that case the behavior you are seeing is correct, even if not obvious or even desirable. It will happen any time you are looping over sys.modules and call a function/method which has a function-scoped import statement for a module that hasn't been imported yet (or calls another function that does so, etc.).
----------
nosy: +eric.snow
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20703>
_______________________________________
More information about the Python-bugs-list
mailing list