[issue20703] RuntimeError caused by lazy imports in pdb

Xavier de Gaye report at bugs.python.org
Fri Feb 27 10:39:51 CET 2015


Xavier de Gaye added the comment:

> 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.).

I do not agree. Suppose there is some piece of code that loops over sys.modules without doing any lazy import (and thus without raising the RuntimeError "dictionary changed size during iteration"). Now, if you insert a pdb.set_trace() in that code, you will get the RuntimeError and this is not correct.

----------

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


More information about the Python-bugs-list mailing list