where to view open() function's C implementation source code ?

Andrew Robinson andrew3 at r3dsolutions.com
Tue Dec 18 22:09:42 CET 2012


On 12/18/2012 07:03 AM, Chris Angelico wrote:
> On Wed, Dec 19, 2012 at 1:28 AM, Roy Smith<roy at panix.com>  wrote:
>> In article<ad040201-ba94-496c-bb17-7433b0e09d9d at googlegroups.com>,
>>   iMath<redstone-cold at 163.com>  wrote:
>>>> Download the source for the version you're interested in.
>>> but which python module is  open() in ?
>> I met you half-way, I showed you where the source code is.  Now you
>> need to come the other half and look at the code.  Maybe start by
>> grepping the entire source tree for "open"?
> Ouch, that mightn't be very effective! With some function names, you
> could do that. Not so much "open". Still, it'd be a start...
>
> ChrisA
In Python3.3.0 -- the built in open() appears in 
Python-3.3.0/Modules/_io/_iomodule.c;
There is another module defined in an object in 
Python-3.3.0/Modules/_io/fileio.c; but I don't think that the one called 
when a lone x=open(...) is done.

Cheers.
--Andrew.



More information about the Python-list mailing list