how/where is open() implemented ?
Hi, I am looking for the implementation of open() in the src, but so far I am not able to do this.
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?
Yubin
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
2017-10-05 19:19 GMT-07:00 Yubin Ruan
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@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ jelle.zijlstra%40gmail.com
On 2017-10-06 03:19, Yubin Ruan wrote:
Hi, I am looking for the implementation of open() in the src, but so far I am not able to do this.
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?
I think it's somewhere in here: https://github.com/python/cpython/blob/master/Modules/_io/fileio.c
participants (3)
-
Jelle Zijlstra
-
MRAB
-
Yubin Ruan