[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

STINNER Victor report at bugs.python.org
Sat Jan 8 07:06:31 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

It's not the first time that private functions included by the public Python.h are causing build errors event if these functions are not used. The previous issue were functions for atomic operations. I solved this build error by moving the whole private C API into the internal C API: Include/internal/pycore_atomic.h. Since that time, we no longer got build error related to this header file.

I propose a similar fix: move all private fileutils.h functions from Include/cpython/fileutils.h to the internal Include/internal/pycore_fileutils.h.

I wrote PR 30484 to implement this change.

To keep the implementation simple, I kept _Py_fopen_obj() in Include/cpython/fileutils.h, for _testcapi which must not use the internal C API.

If this PR is merged, for Python 3.9 and 3.10, I will write a simpler change: modify Include/cpython/fileutils.h to only define functions using "struct stat" in the internal C API (if Py_BUILD_CORE is defined).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46303>
_______________________________________


More information about the Python-bugs-list mailing list