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 yak
Recipients yak
Date 2011-11-03.00:03:16
SpamBayes Score 1.6653345e-16
Marked as misclassified No
Message-id <1320278597.67.0.4589054929.issue13328@psf.upfronthosting.co.za>
In-reply-to
Content
If pdb is used to debug code using zipimport, it may end up displaying source code from wrong module. Python will execute the correct code but the source code lines displayed by pdb (including the "list" command) will come from an unrelated module.

Reason:

The pdb obtains lines of code using the linecache module. When used with zipimported modules, linecache requires the module's globals dict to be passed in along with the filename. The filename is then used as a cache key for future lookups.

A bug in pdb causes it to pass filename and globals from different modules when calling linecache thus polluting the cache with bogus data.

A patch for 2.7.2 is attached that fixes the problem.

The patch also fixes another problem:

When Bdb (Pdb parent class from bdb.py) calls linecache, it calls Bdb.canonic(filename) before passing the filename to it. It doesn't pass the module's globals though. This isn't a problem because the call is always made after Pdb has queried source lines for the same module (and it does pass the globals). However, because Pdb doesn't call Bdb.canonic() on the filename, the cache key is different and Bdb's call fails.

To fix this, the patch adds calls to Bdb.canonic(filename) whenever Pdb passes a filename to linecache.
History
Date User Action Args
2011-11-03 00:03:19yaksetrecipients: + yak
2011-11-03 00:03:17yaksetmessageid: <1320278597.67.0.4589054929.issue13328@psf.upfronthosting.co.za>
2011-11-03 00:03:17yaklinkissue13328 messages
2011-11-03 00:03:16yakcreate