[Python-Dev] file open in python interpreter

Benjamin Peterson musiccomposition at gmail.com
Mon Nov 3 14:29:34 CET 2008


On Mon, Nov 3, 2008 at 7:25 AM, Benjamin Peterson
<musiccomposition at gmail.com> wrote:
> On Mon, Nov 3, 2008 at 1:04 AM, adrian golding <adriangolding at gmail.com> wrote:
>> hi all, i am trying to find out where is the part of the code in the python
>> interpreter that opens up the .py file and parses it. in particular, i am
>> trying to find the file open command in that file.  I greped and i just want
>> to make sure this is it: /Python-2.6/Parser/pgenmain.c
>> i am intending to take a hash measurement of the .py file just before i open
>> it to run the script.  is the above file the right place to call for the
>> measurement before the file open function?
>
> You want Parser/tokenizer.c.

Sorry, that's not correct. opening of modules happens in
Python/import.c. There's also a case in Modules/main.c.

>
>
>
> --
> Cheers,
> Benjamin Peterson
> "There's nothing quite as beautiful as an oboe... except a chicken
> stuck in a vacuum cleaner."
>



-- 
Cheers,
Benjamin Peterson
"There's nothing quite as beautiful as an oboe... except a chicken
stuck in a vacuum cleaner."


More information about the Python-Dev mailing list