[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-12-14 Thread Nick Coghlan
Nick Coghlan added the comment: 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 -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-12-14 Thread Nick Coghlan
Nick Coghlan added the comment: Fixed for 2.7 in r67750. Will be ported to 2.6, 3.0 and 3.1. ___ Python tracker ___ ___ Python-bugs-list maili

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-12-13 Thread Nick Coghlan
Nick Coghlan added the comment: After looking into this, I think Alexander is correct. There is no standard mapping between __file__ and __name__ and linecache is mistaken in assuming such a mapping exists for all importers (and is the same as the standard filesystem to name mapping to boot). I

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-12-03 Thread Nick Coghlan
Changes by Nick Coghlan <[EMAIL PROTECTED]>: -- assignee: -> ncoghlan nosy: +ncoghlan ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Py

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Thanks, Jean-Paul, I can now reproduce your problem and I think I found the culprit. I believe the file name check in linecache.updatecache is unnecessary and is responsible for this problem. With the following patch: --- Lib/lineca

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Jean-Paul Calderone
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment: Here is a transcript for a complete, self-contained, minimal reproduction: [EMAIL PROTECTED]:~$ cd /tmp [EMAIL PROTECTED]:/tmp$ mkdir zipimportbugexample [EMAIL PROTECTED]:/tmp$ cd zipimportbugexample/ [EMAIL PROTECTED]:/tmp/zipimportbug

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: In any case, it's clearly not a candidate for 2.5.3, due to the lack of a clear problem description, and a working patch. That essentially means that associating the version 2.5 is also fairly pointless, but I'll leave that in, anyway. -

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Hmm, apparently inspect was made to work with zipped modules back in r45248 . I cannot reproduce the problem either. Jean-Paul, can you attach your foobar.zip? What else do you have in your /tmp directory? __

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This must be very similar to #4197 and #4201 that I reported a few days ago. I'll see if a similar patch would work in this case. -- nosy: +belopolsky ___ Python tracker <[EMAIL PROTECTED]>

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Jean-Paul Calderone
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment: It seems to depend on working directory: [EMAIL PROTECTED]:/tmp$ python Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Guilherme Polo
Guilherme Polo <[EMAIL PROTECTED]> added the comment: Well anyway, some sample code: import zipfile z = zipfile.ZipFile('aaa.zip', mode='w') z.writestr('aa.py', 'def x(): print "hi there"\n\ndef y(): print "hi"') z.close() and then: import sys import inspect sys.path.append('aaa.zip') impo

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Guilherme Polo
Guilherme Polo <[EMAIL PROTECTED]> added the comment: doesn't it ? it works here -- nosy: +gpolo ___ Python tracker <[EMAIL PROTECTED]> ___

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-10-28 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>: It'd be better if it did. -- components: Library (Lib) messages: 75292 nosy: exarkun severity: normal status: open title: inspect.getsource doesn't work on functions imported from a zipfile type: behavior versions: Python 2.5,