]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110850: Cleanup pycore_time.h includes (#115724)
authorVictor Stinner <vstinner@python.org>
Tue, 20 Feb 2024 16:50:43 +0000 (17:50 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Feb 2024 16:50:43 +0000 (16:50 +0000)
<pycore_time.h> include is no longer needed to get the PyTime_t type
in internal header files. This type is now provided by <Python.h>
include. Add <pycore_time.h> includes to C files instead.

23 files changed:
Include/internal/pycore_import.h
Include/internal/pycore_lock.h
Include/internal/pycore_parking_lot.h
Include/internal/pycore_semaphore.h
Modules/_datetimemodule.c
Modules/_lsprof.c
Modules/_randommodule.c
Modules/_ssl.c
Modules/_testinternalcapi/test_lock.c
Modules/_threadmodule.c
Modules/faulthandler.c
Modules/posixmodule.c
Modules/signalmodule.c
Modules/socketmodule.c
Modules/socketmodule.h
Modules/timemodule.c
Python/gc.c
Python/gc_free_threading.c
Python/import.c
Python/lock.c
Python/parking_lot.c
Python/thread_nt.h
Python/thread_pthread.h

index 5f49b9aa6dfebfa0376d0a1514c111d7bf5e60de..eb8a9a0db46c221ff52f1e19feacdf3abf0c8d65 100644 (file)
@@ -11,7 +11,6 @@ extern "C" {
 
 #include "pycore_lock.h"          // PyMutex
 #include "pycore_hashtable.h"     // _Py_hashtable_t
-#include "pycore_time.h"          // PyTime_t
 
 extern int _PyImport_IsInitialized(PyInterpreterState *);
 
index 1aaa6677932282d42cb4d95201659661de050890..07bf3db16f3d3afa3a5238867b27d9fd9c52b28a 100644 (file)
@@ -13,8 +13,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_time.h"          // PyTime_t
-
 
 // A mutex that occupies one byte. The lock can be zero initialized.
 //
index a192228970c6a30a1a8895a36fc2be4ce52edd06..8c9260e2636fbc7ec0396ac443bdd6fdbafb67df 100644 (file)
@@ -18,8 +18,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_time.h"        // PyTime_t
-
 
 enum {
     // The thread was unparked by another thread.
index e1963a6ea239e1755ea1f9f81dfca03d54851bf3..ffcc6d80344d6ea2fc36ec462d74bb81269613d5 100644 (file)
@@ -8,7 +8,6 @@
 #endif
 
 #include "pycore_pythread.h"      // _POSIX_SEMAPHORES
-#include "pycore_time.h"          // PyTime_t
 
 #ifdef MS_WINDOWS
 #   define WIN32_LEAN_AND_MEAN
index b8bd70250aee299d65c4aeaad601c0d1a2e0d4e4..3ae95a8c9a87a7452b9e44a0bf9135df9ac9000b 100644 (file)
@@ -14,6 +14,8 @@
 #include "Python.h"
 #include "pycore_long.h"          // _PyLong_GetOne()
 #include "pycore_object.h"        // _PyObject_Init()
+#include "pycore_time.h"          // _PyTime_ObjectToTime_t()
+
 #include "datetime.h"
 
 
index eae4261f4953f503c811195f2b0fa42a4630d855..928baf034f62a390b15eab90fd60538b19b420f6 100644 (file)
@@ -6,6 +6,7 @@
 #include "pycore_call.h"          // _PyObject_CallNoArgs()
 #include "pycore_ceval.h"         // _PyEval_SetProfile()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_time.h"          // _PyTime_FromNanosecondsObject()
 
 #include "rotatingtree.h"
 
index 4463157d62248ddeebfb8e14c1220cb4d1eca17b..62f1acaf887296199a81d49230239fa4183352e6 100644 (file)
@@ -75,6 +75,7 @@
 #include "pycore_modsupport.h"    // _PyArg_NoKeywords()
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "pycore_pylifecycle.h"   // _PyOS_URandomNonblock()
+#include "pycore_time.h"          // _PyTime_GetSystemClock()
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>             // getpid()
index 1bf7241042d39a97a067910776df859c8947a954..d00f407b569fb69c080e3d7c25b2a4b1fbd240b8 100644 (file)
@@ -28,6 +28,7 @@
 #include "Python.h"
 #include "pycore_fileutils.h"     // _PyIsSelectable_fd()
 #include "pycore_pyerrors.h"      // _PyErr_ChainExceptions1()
+#include "pycore_time.h"          // _PyDeadline_Init()
 #include "pycore_weakref.h"       // _PyWeakref_GET_REF()
 
 /* Include symbols from _socket module */
index 9facbc5bccf9f934b5c0cae4be9408149c657369..724bbd0e8f0c9d0aeeaaf0dffb59f12892cd02e0 100644 (file)
@@ -1,8 +1,9 @@
 // C Extension module to test pycore_lock.h API
 
 #include "parts.h"
-
 #include "pycore_lock.h"
+#include "pycore_time.h"          // _PyTime_GetMonotonicClock()
+
 #include "clinic/test_lock.c.h"
 
 #ifdef MS_WINDOWS
index 226053437bc2cd9dcf9abc90688f8f2d1b36679d..addaafb4f860398e5c60938ddf2f582208a7b7e8 100644 (file)
@@ -9,6 +9,7 @@
 #include "pycore_pylifecycle.h"
 #include "pycore_pystate.h"       // _PyThreadState_SetCurrent()
 #include "pycore_sysmodule.h"     // _PySys_GetAttr()
+#include "pycore_time.h"          // _PyTime_FromSeconds()
 #include "pycore_weakref.h"       // _PyWeakref_GET_REF()
 
 #include <stdbool.h>
index 91255fc98885aec9dfbfe26352c4ea39e0f9f356..02e94a2119148390a56fe168eccecd52d2c12d5e 100644 (file)
@@ -4,6 +4,7 @@
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_signal.h"        // Py_NSIG
 #include "pycore_sysmodule.h"     // _PySys_GetAttr()
+#include "pycore_time.h"          // _PyTime_FromSecondsObject()
 #include "pycore_traceback.h"     // _Py_DumpTracebackThreads
 
 #ifdef HAVE_UNISTD_H
index 4165fb66cc10dd34a0500e84950e075895ab8e44..fd70b38bddec79e235a47398fe72f6b1c3cd100c 100644 (file)
@@ -23,6 +23,7 @@
 #include "pycore_pylifecycle.h"   // _PyOS_URandom()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_signal.h"        // Py_NSIG
+#include "pycore_time.h"          // _PyLong_FromTime_t()
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>             // symlink()
index a968cb1b0aa49cd1f79b7070dd1d430c497ebe92..5804e30af1b42651b354f0f573fa06081d103340 100644 (file)
@@ -13,6 +13,7 @@
 #include "pycore_pyerrors.h"      // _PyErr_SetString()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_signal.h"        // _Py_RestoreSignals()
+#include "pycore_time.h"          // _PyTime_FromSecondsObject()
 
 #ifndef MS_WINDOWS
 #  include "posixmodule.h"        // _PyLong_FromUid()
index 9f70dbe4a83c2fdea3070f896356a55775e2695b..298c0e29d0d9b8a8182598bc80003e553be62b91 100644 (file)
@@ -109,6 +109,7 @@ Local naming conventions:
 #include "pycore_capsule.h"       // _PyCapsule_SetTraverse()
 #include "pycore_fileutils.h"     // _Py_set_inheritable()
 #include "pycore_moduleobject.h"  // _PyModule_GetState
+#include "pycore_time.h"          // _PyTime_AsMilliseconds()
 
 #ifdef _Py_MEMORY_SANITIZER
 #  include <sanitizer/msan_interface.h>
index a7c592c83aa25f768275b848ce9e56f2eda8b062..09fd70f351f1d84e64678f5018ffb72c0076a711 100644 (file)
@@ -1,7 +1,5 @@
 /* Socket module header file */
 
-#include "pycore_time.h"          // PyTime_t
-
 /* Includes needed for the sockaddr_* symbols below */
 #ifndef MS_WINDOWS
 #ifdef __VMS
index 16769b2405f706331e04205a4207b9bfd2006f0e..73b9fc067af6fffb234f9a05aef024584d806faf 100644 (file)
@@ -5,6 +5,7 @@
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "pycore_namespace.h"     // _PyNamespace_New()
 #include "pycore_runtime.h"       // _Py_ID()
+#include "pycore_time.h"          // _PyTimeFraction
 
 #include <time.h>                 // clock()
 #ifdef HAVE_SYS_TIMES_H
index b665e4681b3c39a6185cb38c28ce3d33b8a468ad..907f29baa3777aad2107fa15c2e515a2639d7ecd 100644 (file)
@@ -12,6 +12,7 @@
 #include "pycore_object_alloc.h"  // _PyObject_MallocWithType()
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_time.h"          // _PyTime_GetPerfCounter()
 #include "pycore_weakref.h"       // _PyWeakref_ClearRef()
 #include "pydtrace.h"
 
index 0f159f4a272be6df060b1ce584d2e1eee6585f32..88c9c4ae5d77b92b2f8f7d17995f783ddeb15f3a 100644 (file)
@@ -11,6 +11,7 @@
 #include "pycore_object_stack.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_time.h"          // _PyTime_GetPerfCounter()
 #include "pycore_tstate.h"        // _PyThreadStateImpl
 #include "pycore_weakref.h"       // _PyWeakref_ClearRef()
 #include "pydtrace.h"
index 6512963d9f6bed9b1cfb5c588518bee7f61f6a7d..a8fed67755256e348e923396abbe8cfb81c1d07c 100644 (file)
@@ -13,6 +13,7 @@
 #include "pycore_pymem.h"         // _PyMem_SetDefaultAllocator()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_sysmodule.h"     // _PySys_Audit()
+#include "pycore_time.h"          // _PyTime_GetPerfCounter()
 #include "pycore_weakref.h"       // _PyWeakref_GET_REF()
 
 #include "marshal.h"              // PyMarshal_ReadObjectFromString()
index 0c0d298f17d54ff4aeade30fbc7f9834c637fcbc..a4b044ecff0d70defc198f51a4d2f5102e863b89 100644 (file)
@@ -5,12 +5,13 @@
 #include "pycore_lock.h"
 #include "pycore_parking_lot.h"
 #include "pycore_semaphore.h"
+#include "pycore_time.h"          // _PyTime_GetMonotonicClock()
 
 #ifdef MS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>        // SwitchToThread()
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>        // SwitchToThread()
 #elif defined(HAVE_SCHED_H)
-#include <sched.h>          // sched_yield()
+#  include <sched.h>          // sched_yield()
 #endif
 
 // If a thread waits on a lock for longer than TIME_TO_BE_FAIR_NS (1 ms), then
index 9a8a403a746914fecbbe4c16c821b45e205d3ac3..9bf8376e485ea49a704a7ba9c0ebd3f4cfa43418 100644 (file)
@@ -1,11 +1,12 @@
 #include "Python.h"
 
 #include "pycore_llist.h"
-#include "pycore_lock.h"        // _PyRawMutex
+#include "pycore_lock.h"          // _PyRawMutex
 #include "pycore_parking_lot.h"
-#include "pycore_pyerrors.h"    // _Py_FatalErrorFormat
-#include "pycore_pystate.h"     // _PyThreadState_GET
-#include "pycore_semaphore.h"   // _PySemaphore
+#include "pycore_pyerrors.h"      // _Py_FatalErrorFormat
+#include "pycore_pystate.h"       // _PyThreadState_GET
+#include "pycore_semaphore.h"     // _PySemaphore
+#include "pycore_time.h"          //_PyTime_GetMonotonicClock()
 
 #include <stdbool.h>
 
index 9ca2a55cae5eef83b59800fdb872f7efff0090a1..307352f592e70e972ab196c8f2c0d386ca06ab6c 100644 (file)
@@ -1,4 +1,5 @@
-#include "pycore_interp.h"    // _PyInterpreterState.threads.stacksize
+#include "pycore_interp.h"        // _PyInterpreterState.threads.stacksize
+#include "pycore_time.h"          // _PyTime_AsMicroseconds()
 
 /* This code implemented by Dag.Gruneau@elsa.preseco.comm.se */
 /* Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru */
index ce0af736e8f7e45811cae39fd033960655e37d73..9db6a4666f510c4fbe180e3571002d2d73f178ba 100644 (file)
@@ -1,5 +1,6 @@
 #include "pycore_interp.h"        // _PyInterpreterState.threads.stacksize
 #include "pycore_pythread.h"      // _POSIX_SEMAPHORES
+#include "pycore_time.h"          // _PyTime_FromMicrosecondsClamup()
 
 /* Posix threads interface */