-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-127350: Add Py_fopen() function #127821
base: main
Are you sure you want to change the base?
Conversation
Rename _Py_fopen_obj() to Py_fopen(). The function now also accepts bytes path on Windows. Remove the private, undocumented, and untested function _Py_fopen_obj().
Do we need |
|
To be honest, I don't understand well the Windows DLL issue. From what I understood, to use a |
PyRun_AnyFileExFlags has "closeit" parameter which I always used. Thank you guys for doing all this. |
Is Py_fclose() needed because of the DLL issue? |
Yes. When you call |
Ok, I wanted to make sure that I get the rationale correctly. I added |
Your updated documentation seems a bit snarky. The I see no reason not to just document it as "should be used to close files opened by |
It's not my intent to be snarky. I just tried to explain why calling fclose() directly can cause issues in practice.
Ok, let's do that. |
Co-authored-by: Steve Dower <[email protected]>
Rename _Py_fopen_obj() to Py_fopen(). The function now also accepts bytes path on Windows.
Remove the private, undocumented, and untested function _Py_fopen_obj().
📚 Documentation preview 📚: https://cpython-previews--127821.org.readthedocs.build/