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 Erik.Tollerud
Recipients Erik.Tollerud
Date 2011-11-27.03:06:47
SpamBayes Score 2.652989e-12
Marked as misclassified No
Message-id <1322363209.24.0.0935380803772.issue13487@psf.upfronthosting.co.za>
In-reply-to
Content
The inspect.getmodule function crashes if packages are installed that futz with sys.modules while they are being tested for module status or the like.  I'm not actually sure which packages are doing this, but the symptom is the for loop over sys.modules raises an Exception because it is modified while the loop is running.

This is *not* a problem in Python 2.x because sys.modules.items() returns a copy of the dictionary instead of an iterator, and 3.x changes that behavior.  The comment above the for loop makes it clear that the expected behavior is a copy rather than an iterator, so the attached patch corrects the problem by simply wrapping the items() call in list().
History
Date User Action Args
2011-11-27 03:06:49Erik.Tollerudsetrecipients: + Erik.Tollerud
2011-11-27 03:06:49Erik.Tollerudsetmessageid: <1322363209.24.0.0935380803772.issue13487@psf.upfronthosting.co.za>
2011-11-27 03:06:48Erik.Tollerudlinkissue13487 messages
2011-11-27 03:06:48Erik.Tollerudcreate