> On Wed, Feb 3, 2010 at 14:40, Michael Foord <fuzzy...@voidspace.org.uk>
> wrote:
>> Isn't __file__ usually baked into .pyc files at compile time? (At least I
>> assumed that from the incorrect tracebacks on Windows when you ship just
>> .pyc files.)

On Wed, Feb 3, 2010 at 2:48 PM, Brett Cannon <br...@python.org> wrote:
> Yes, but import.c back-patches before loading to get around this. This will
> eventually get fixed, though: see http://bugs.python.org/issue6811 .

Actually not quite. __file__ never comes from the .pyc file, it always
gets set by the import process. What comes from the .pyc file (and
what that bug is asking to fix fix) is the co_filename attribute of
the marshalled code objects. (BTW I have my own reasons for wanting
the latter to be fixed.)

--Guido van Rossum (python.org/~guido)
Python-Dev mailing list

Reply via email to