Skip to content

Commit

Permalink
pythongh-108765: Python.h no longer includes <sys/time.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Sep 1, 2023
1 parent 45b9e6a commit 12a842c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
19 changes: 0 additions & 19 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,6 @@ typedef Py_ssize_t Py_ssize_clean_t;

#include <math.h> /* Moved here from the math section, before extern "C" */

/********************************************
* WRAPPER FOR <time.h> and/or <sys/time.h> *
********************************************/

#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>

/******************************
* WRAPPER FOR <sys/select.h> *
******************************/

/* NB caller must include <sys/types.h> */

#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* !HAVE_SYS_SELECT_H */

/*******************************
* stat() and fstat() fiddling *
*******************************/
Expand Down
4 changes: 4 additions & 0 deletions Modules/_multiprocessing/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

#include "multiprocessing.h"

#ifdef HAVE_SYS_TIME_H
# include <sys/time.h> // gettimeofday()
#endif

#ifdef HAVE_MP_SEMAPHORE

enum { RECURSIVE_MUTEX, SEMAPHORE };
Expand Down
4 changes: 4 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@

#include <stdio.h> // ctermid()
#include <stdlib.h> // system()
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h> // futimes()
#endif


/*
* A number of APIs are available on macOS from a certain macOS version.
Expand Down
2 changes: 1 addition & 1 deletion Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "pycore_runtime.h" // _Py_ID()

#include <ctype.h>

#include <time.h> // clock()
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions Modules/xxsubtype.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Python.h"

#include <stddef.h> // offsetof()
#include <time.h> // clock()


PyDoc_STRVAR(xxsubtype__doc__,
Expand Down
5 changes: 5 additions & 0 deletions Python/pytime.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "Python.h"
#include "pycore_time.h" // _PyTime_t

#include <time.h> // gmtime_r() on Windows
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h> // gettimeofday()
#endif
#ifdef MS_WINDOWS
# include <winsock2.h> // struct timeval
#endif
Expand Down

0 comments on commit 12a842c

Please sign in to comment.