diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-30 22:06:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 20:06:45 +0000 |
commit | 7513994c927857679544449392744be308d36586 (patch) | |
tree | 7d8bf43e49011f210dac2d282223aa1ee88f7d01 /Python/fileutils.c | |
parent | 0def8c712bb6f66f1081cab71deb3681566b846d (diff) | |
download | cpython-7513994c927857679544449392744be308d36586.tar.gz cpython-7513994c927857679544449392744be308d36586.zip |
gh-110014: Include explicitly <unistd.h> header (#110155)
* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They are already
included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
are already defined, like the __NEED_pthread_t macro.
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r-- | Python/fileutils.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 9bc1de2db84..17a4ae56ef0 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -2,8 +2,11 @@ #include "pycore_fileutils.h" // fileutils definitions #include "pycore_runtime.h" // _PyRuntime #include "osdefs.h" // SEP -#include <locale.h> + #include <stdlib.h> // mbstowcs() +#ifdef HAVE_UNISTD_H +# include <unistd.h> // getcwd() +#endif #ifdef MS_WINDOWS # include <malloc.h> @@ -19,7 +22,7 @@ extern int winerror_to_errno(int); #endif #ifdef HAVE_LANGINFO_H -#include <langinfo.h> +# include <langinfo.h> // nl_langinfo(CODESET) #endif #ifdef HAVE_SYS_IOCTL_H @@ -27,12 +30,12 @@ extern int winerror_to_errno(int); #endif #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION -#include <iconv.h> +# include <iconv.h> // iconv_open() #endif #ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif /* HAVE_FCNTL_H */ +# include <fcntl.h> // fcntl(F_GETFD) +#endif #ifdef O_CLOEXEC /* Does open() support the O_CLOEXEC flag? Possible values: |