Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: I have attached a rough patch implementing the get_filename. I deliberately copied code from get_source method that finds the filename inside the zip archive and simply prefixed that with the archive path.
I could not find any detailed discussion of what get_filename is supposed to do. Pkgutil's get_filename is not documented and not unit- tested. Google search revealed an old thread at <http://mail.python.org/pipermail/python-dev/2006-April/063626.html>, but it only says """ >runpy needs a get_filename() method, so it knows what to set __file__ too - >currently its emulation supports that, but it isn't officially part of the >PEP >302 API. It sounds like maybe a new PEP is needed to document all the extensions to the importer/loader protocols. :( """ I don't think a brand new PEP is needed, but an amendment to PEP 302 would be helpful. Nick, do you have any notes on what get_filename should do in various cases? My implementation fixes one of the problems in issue4197: $ ./python.exe testmodule.zip ********************************************************************** File "testmodule.zip/__main__.py", line ?, in __main__.c Failed example: 'line 2' Expected nothing Got: 'line 2' ********************************************************************** 1 items had failures: 1 of 1 in __main__.c ***Test Failed*** 1 failures. Note that line number is still reported as '?', but there is no crash. _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4512> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com