[Python-Dev] how/where is open() implemented ?
Jelle Zijlstra
jelle.zijlstra at gmail.com
Thu Oct 5 22:53:29 EDT 2017
2017-10-05 19:19 GMT-07:00 Yubin Ruan <ablacktshirt at gmail.com>:
> Hi,
> I am looking for the implementation of open() in the src, but so far I
> am not able to do this.
>
> In Python 3, builtins.open is the same as io.open, which is implemented in
the _io_open function in Modules/_io/_iomodule.c.
> From my observation, the implementation of open() in python2/3 does
> not employ the open(2) system call. However without open(2) how can
> one possibly obtain a file descriptor?
>
There is a call to open() (the C function) in _io_FileIO___init___impl in
Modules/_io/fileio.c. I haven't traced through all the code, but I suspect
builtins.open ends up calling that.
>
> Yubin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> jelle.zijlstra%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171005/56e5f407/attachment.html>
More information about the Python-Dev
mailing list