2

I am looking for the source code for python built in function open(),
I've checked the bltinmodule.c but found no open() inside.
Does anyone know where the source of open() is?
Or, how to find it?
Thank you.

2
  • 1
    please refer to this link stackoverflow.com/questions/8608587/… Commented May 9, 2017 at 7:29
  • Look in Lib/_pyio.py. Depending on what you want, you might also need Objects/fileobject.c Commented May 9, 2017 at 7:35

1 Answer 1

5

With Python on GitHub, have a look at:

Sign up to request clarification or add additional context in comments.

3 Comments

Function names (API level) would be a better reference since the source code changes with time and the line number links would become outdated.
@kapad Feel free to provide this information and I might find the time to update. Of course you can always create your own answer.
I'm not sure I'll be able to find the correct references. Your answer lacks the function names in the files linked. And the files linked have since changed. Therefore, I don't see the source code for the open() function when I check those links. For eg: the link for fileutils.c points to a method named _Py_ConvertWCharForm, which I don't think is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.