summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-30 20:06:45 (GMT)
committerGitHub <noreply@github.com>2023-09-30 20:06:45 (GMT)
commit7513994c927857679544449392744be308d36586 (patch)
tree7d8bf43e49011f210dac2d282223aa1ee88f7d01 /Parser
parent0def8c712bb6f66f1081cab71deb3681566b846d (diff)
downloadcpython-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 'Parser')
-rw-r--r--Parser/myreadline.c6
-rw-r--r--Parser/tokenizer.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 8153873..719a178 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -14,11 +14,15 @@
#include "pycore_pystate.h" // _PyThreadState_GET()
#ifdef MS_WINDOWS
# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
# endif
# include "windows.h"
#endif /* MS_WINDOWS */
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // isatty()
+#endif
+
// Export the symbol since it's used by the readline shared extension
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 46b7159..41d0d16 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -4,10 +4,12 @@
#include "Python.h"
#include "pycore_call.h" // _PyObject_CallNoArgs()
-#include <assert.h>
+#include "tokenizer.h" // struct tok_state
+#include "errcode.h" // E_OK
-#include "tokenizer.h"
-#include "errcode.h"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // read()
+#endif
/* Alternate tab spacing */
#define ALTTABSIZE 1