Skip to content

Commit

Permalink
pythongh-108765: Python.h no longer includes <unistd.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Sep 1, 2023
1 parent 1b43dc1 commit 6aede60
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
#ifdef HAVE_STDDEF_H
# include <stddef.h> // size_t
#endif
#ifndef MS_WINDOWS
# include <unistd.h> // sysconf()
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> // ssize_t
#endif

// errno.h, stdio.h, stdlib.h and string.h headers are no longer used by Python
// headers, but kept for backward compatibility (no introduce new compiler
// warnings). They are not included by the limited C API version 3.11 and
// above.
// 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.
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
# include <errno.h> // errno
# include <stdio.h> // FILE*
Expand Down
3 changes: 2 additions & 1 deletion Modules/grpmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include "Python.h"
#include "posixmodule.h"

#include <grp.h>
#include <grp.h> // getgrgid_r()
#include <unistd.h> // sysconf()

#include "clinic/grpmodule.c.h"
/*[clinic input]
Expand Down
1 change: 1 addition & 0 deletions Modules/mmapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "pycore_fileutils.h" // _Py_stat_struct

#include <stddef.h> // offsetof()
#include <unistd.h> // close()

// to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA
// need to be replaced with OpenFileMappingW / CreateFileMappingW
Expand Down
4 changes: 3 additions & 1 deletion Modules/pwdmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include "Python.h"
#include "posixmodule.h"

#include <pwd.h>
#include <pwd.h> // getpwuid()
#include <unistd.h> // sysconf()


#include "clinic/pwdmodule.c.h"
/*[clinic input]
Expand Down
1 change: 1 addition & 0 deletions Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "pycore_time.h" // _PyTime_t

#include <stddef.h> // offsetof()
#include <unistd.h> // close()

#ifdef HAVE_SYS_DEVPOLL_H
#include <sys/resource.h>
Expand Down

0 comments on commit 6aede60

Please sign in to comment.