summaryrefslogtreecommitdiffstats
path: root/Include/Python.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-11-15 15:59:32 (GMT)
committerGitHub <noreply@github.com>2023-11-15 15:59:32 (GMT)
commitb338ffa4bc078fd363e8b0078eef4e0d6a071546 (patch)
tree6a8f88cfbc694dddf9d3e97d19b397b254da7b9b /Include/Python.h
parent4bbb367ba65e1df7307f7c6a33afd3c369592188 (diff)
downloadcpython-b338ffa4bc078fd363e8b0078eef4e0d6a071546.zip
cpython-b338ffa4bc078fd363e8b0078eef4e0d6a071546.tar.gz
cpython-b338ffa4bc078fd363e8b0078eef4e0d6a071546.tar.bz2
gh-112026: Add again <unistd.h> include in Python.h (#112046)
Add again <ctype.h> and <unistd.h> includes in Python.h, but don't include them in the limited C API version 3.13 and newer.
Diffstat (limited to 'Include/Python.h')
-rw-r--r--Include/Python.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/Include/Python.h b/Include/Python.h
index a1f26af..196751c 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -26,15 +26,24 @@
# include <sys/types.h> // ssize_t
#endif
-// errno.h, stdio.h, stdlib.h and string.h headers are no longer used by
-// Python, but kept for backward compatibility (avoid compiler warnings).
-// They are no longer included by limited C API version 3.11 and newer.
+// <errno.h>, <stdio.h>, <stdlib.h> and <string.h> headers are no longer used
+// by Python, but kept for the backward compatibility of existing third party C
+// extensions. They are not included by limited C API version 3.11 and newer.
+//
+// The <ctype.h> and <unistd.h> headers are not included by limited C API
+// version 3.13 and newer.
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
# include <errno.h> // errno
# include <stdio.h> // FILE*
# include <stdlib.h> // getenv()
# include <string.h> // memcpy()
#endif
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000
+# include <ctype.h> // tolower()
+# ifndef MS_WINDOWS
+# include <unistd.h> // close()
+# endif
+#endif
// Include Python header files