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 eric.snow
Recipients BreamoreBoy, eric.snow, georg.brandl, josh.r, xdegaye
Date 2015-02-26.15:31:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424964667.85.0.354615166816.issue20703@psf.upfronthosting.co.za>
In-reply-to
Content
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.).
History
Date User Action Args
2015-02-26 15:31:07eric.snowsetrecipients: + eric.snow, georg.brandl, BreamoreBoy, xdegaye, josh.r
2015-02-26 15:31:07eric.snowsetmessageid: <1424964667.85.0.354615166816.issue20703@psf.upfronthosting.co.za>
2015-02-26 15:31:07eric.snowlinkissue20703 messages
2015-02-26 15:31:07eric.snowcreate