Issue 4201: Pdb cannot access source code in zipped packages. (original) (raw)

Created on 2008-10-24 22:52 by belopolsky, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.zip belopolsky,2008-10-24 22:52 Zip file with a module containing a call to pdb
pdb.patch belopolsky,2008-10-24 22:52
Messages (8)
msg75197 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-10-24 22:52
With attached test.zip and svn revision 67006, $ ./python.exe test.zip > /Users/sasha/Work/python-svn/trunk/test.zip/__main__.py(2)f() (Pdb) l [EOF] With pdb.patch: $ ./python.exe test.zip > /Users/sasha/Work/python-svn/trunk/test.zip/__main__.py(2)f() -> pass (Pdb) l 1 def f(): 2 -> pass 3 4 import pdb 5 pdb.runcall(f) 6 7 [EOF]
msg76838 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2008-12-03 20:51
Just to confirm - this is specific to __main__.py right? The problem is actually with runpy not being able to set __file__ correctly, rather than being pdb specific.
msg76854 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-12-03 23:58
No, I only used __main__.py to make it easy to reproduce the problem. Pdb will not be able to access code in any module with a custom __loader__. For example, if you move f() to foo.py inside test.zip and import it from __main__, you will see the same issue. My patch gives linecache.getlines() called by Pdb access to module's globs and thus to its __loader__ . It has nothing to do with runpy. > The problem is actually with runpy not being able to set __file__ > correctly, rather than being pdb specific. You must be thinking where two distinct problems are adressed: first, the crash due to __file__ set to None by runpy and second, missing globs parameter to linecache.getlines() in doctest module. My patch, doctest-1.patch works around the first issue and fixes the second.
msg76858 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-12-04 00:34
Off-topic: How to report a bug tracker bug? The e-mail I sent in response to Nick's post started with: """ On Wed, Dec 3, 2008 at 3:51 PM, Nick Coghlan <report@bugs.python.org> wrote: > Just to confirm - this is specific to __main__.py right? > No, I only used __main__.py to make it easy to reproduce the problem. ... """ But the first two lines got eaten by the tracker. Should I open an issue here and if so, what do I set as a component?
msg76878 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2008-12-04 10:44
Issues with the tracker itself go in the meta tracker (see the "Report Tracker Problem" link at the bottom of the left hand navigation menu). It's a separate tracker in order to handle cases where the main tracker is actually down in addition to problems with the functionality. And you're right that the get_filename() limitation is only part of the story rather than all of it (for both this and other issues). I'll still try to look at them all in one go this weekend though.
msg77512 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-10 08:57
The patch hasn't been accepted for the trunk, yet, so it is out of scope for 2.5.3. Retargetting.
msg77784 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2008-12-14 10:56
Fixed for 2.7 in r67750. Will be ported to 2.6, 3.0 and 3.1.
msg77792 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2008-12-14 12:11
Final revisions for fix: 2.7 = r67751 (there was a new test file missing from the initial checkin) 2.6 = r67752 3.1 = r67753 3.0 = r67754
History
Date User Action Args
2022-04-11 14:56:40 admin set github: 48451
2008-12-14 12:11:38 ncoghlan set status: open -> closedresolution: fixedmessages: +
2008-12-14 10:56:53 ncoghlan set messages: +
2008-12-10 08:57:14 loewis set nosy: + loewismessages: + versions: + Python 2.7, - Python 2.5.3
2008-12-04 10:44:14 ncoghlan set messages: +
2008-12-04 00:34:25 belopolsky set messages: +
2008-12-03 23:58:23 belopolsky set messages: +
2008-12-03 20:51:35 ncoghlan set messages: +
2008-12-03 20:28:51 ncoghlan set assignee: ncoghlannosy: + ncoghlan
2008-10-25 01:52:58 belopolsky set type: behaviorcomponents: + Library (Lib)versions: + Python 2.5.3
2008-10-24 22:52:30 belopolsky set files: + pdb.patchkeywords: + patch
2008-10-24 22:52:22 belopolsky create