diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-30 20:06:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 20:06:45 (GMT) |
commit | 7513994c927857679544449392744be308d36586 (patch) | |
tree | 7d8bf43e49011f210dac2d282223aa1ee88f7d01 /Objects/fileobject.c | |
parent | 0def8c712bb6f66f1081cab71deb3681566b846d (diff) | |
download | cpython-7513994c927857679544449392744be308d36586.zip cpython-7513994c927857679544449392744be308d36586.tar.gz cpython-7513994c927857679544449392744be308d36586.tar.bz2 |
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 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 066172b..5522eba 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -4,15 +4,19 @@ #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_runtime.h" // _PyRuntime +#ifdef HAVE_UNISTD_H +# include <unistd.h> // isatty() +#endif + #if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER) -/* clang MemorySanitizer doesn't yet understand getc_unlocked. */ -#define GETC(f) getc_unlocked(f) -#define FLOCKFILE(f) flockfile(f) -#define FUNLOCKFILE(f) funlockfile(f) + /* clang MemorySanitizer doesn't yet understand getc_unlocked. */ +# define GETC(f) getc_unlocked(f) +# define FLOCKFILE(f) flockfile(f) +# define FUNLOCKFILE(f) funlockfile(f) #else -#define GETC(f) getc(f) -#define FLOCKFILE(f) -#define FUNLOCKFILE(f) +# define GETC(f) getc(f) +# define FLOCKFILE(f) +# define FUNLOCKFILE(f) #endif /* Newline flags */ |