https://github.com/python/cpython/commit/344f3c3fd41091188b7e429b9d8bf64fea9a5866
commit: 344f3c3fd41091188b7e429b9d8bf64fea9a5866
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-19T23:46:25Z
summary:

gh-131238: Remove pycore_lock.h includes (#131483)

PyMutex type is now part of <Python.h>, it's no longer needed to
include <pycore_lock.h> to get it.

files:
M Include/internal/pycore_ast_state.h
M Include/internal/pycore_atexit.h
M Include/internal/pycore_brc.h
M Include/internal/pycore_ceval_state.h
M Include/internal/pycore_code.h
M Include/internal/pycore_codecs.h
M Include/internal/pycore_critical_section.h
M Include/internal/pycore_crossinterp.h
M Include/internal/pycore_function.h
M Include/internal/pycore_import.h
M Include/internal/pycore_pymem.h
M Include/internal/pycore_qsbr.h
M Include/internal/pycore_unicodeobject.h
M Include/internal/pycore_weakref.h
M Parser/asdl_c.py

diff --git a/Include/internal/pycore_ast_state.h 
b/Include/internal/pycore_ast_state.h
index 09ae95465495c0..2f9d5ea366eade 100644
--- a/Include/internal/pycore_ast_state.h
+++ b/Include/internal/pycore_ast_state.h
@@ -3,7 +3,7 @@
 #ifndef Py_INTERNAL_AST_STATE_H
 #define Py_INTERNAL_AST_STATE_H
 
-#include "pycore_lock.h"    // _PyOnceFlag
+#include "pycore_lock.h"          // _PyOnceFlag
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/Include/internal/pycore_atexit.h b/Include/internal/pycore_atexit.h
index 4d4c455cc4b24f..1199b00ead3769 100644
--- a/Include/internal/pycore_atexit.h
+++ b/Include/internal/pycore_atexit.h
@@ -1,8 +1,6 @@
 #ifndef Py_INTERNAL_ATEXIT_H
 #define Py_INTERNAL_ATEXIT_H
 
-#include "pycore_lock.h"        // PyMutex
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/Include/internal/pycore_brc.h b/Include/internal/pycore_brc.h
index 3453d83b57ca97..cd3c9ac26b5a66 100644
--- a/Include/internal/pycore_brc.h
+++ b/Include/internal/pycore_brc.h
@@ -3,7 +3,6 @@
 
 #include <stdint.h>
 #include "pycore_llist.h"           // struct llist_node
-#include "pycore_lock.h"            // PyMutex
 #include "pycore_object_stack.h"    // _PyObjectStack
 
 #ifdef __cplusplus
diff --git a/Include/internal/pycore_ceval_state.h 
b/Include/internal/pycore_ceval_state.h
index 8077c8c68819e3..64128a78136e56 100644
--- a/Include/internal/pycore_ceval_state.h
+++ b/Include/internal/pycore_ceval_state.h
@@ -8,7 +8,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_lock.h"            // PyMutex
 #include "pycore_gil.h"             // struct _gil_runtime_state
 
 
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index a1a04815d86536..e6c388080ea79c 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -10,7 +10,6 @@ extern "C" {
 
 #include "pycore_structs.h"     // _Py_CODEUNIT
 #include "pycore_stackref.h"    // _PyStackRef
-#include "pycore_lock.h"        // PyMutex
 #include "pycore_backoff.h"     // _Py_BackoffCounter
 #include "pycore_tstate.h"      // _PyThreadStateImpl
 
diff --git a/Include/internal/pycore_codecs.h b/Include/internal/pycore_codecs.h
index 01b31d31998e53..52dca1362592d6 100644
--- a/Include/internal/pycore_codecs.h
+++ b/Include/internal/pycore_codecs.h
@@ -9,7 +9,6 @@ extern "C" {
 #endif
 
 #include "pycore_interp_structs.h" // struct codecs_state
-#include "pycore_lock.h"          // PyMutex
 
 /* Initialize codecs-related state for the given interpreter, including
    registering the first codec search function. Must be called before any other
diff --git a/Include/internal/pycore_critical_section.h 
b/Include/internal/pycore_critical_section.h
index e66d6d805c1b3b..42f06b935bd0a0 100644
--- a/Include/internal/pycore_critical_section.h
+++ b/Include/internal/pycore_critical_section.h
@@ -5,7 +5,7 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_lock.h"        // PyMutex
+#include "pycore_lock.h"        // PyMutex_LockFast()
 #include "pycore_pystate.h"     // _PyThreadState_GET()
 #include <stdint.h>
 
diff --git a/Include/internal/pycore_crossinterp.h 
b/Include/internal/pycore_crossinterp.h
index 69a60d73e05c26..d3226d2b425f66 100644
--- a/Include/internal/pycore_crossinterp.h
+++ b/Include/internal/pycore_crossinterp.h
@@ -8,7 +8,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_lock.h"            // PyMutex
 #include "pycore_pyerrors.h"
 
 
diff --git a/Include/internal/pycore_function.h 
b/Include/internal/pycore_function.h
index 8fa040fec3bf03..209252b2ddc0de 100644
--- a/Include/internal/pycore_function.h
+++ b/Include/internal/pycore_function.h
@@ -4,8 +4,6 @@
 extern "C" {
 #endif
 
-#include "pycore_lock.h"
-
 #ifndef Py_BUILD_CORE
 #  error "this header requires Py_BUILD_CORE define"
 #endif
diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h
index f99ab59140f0dc..3acafd02bbdd7c 100644
--- a/Include/internal/pycore_import.h
+++ b/Include/internal/pycore_import.h
@@ -11,7 +11,6 @@ extern "C" {
 
 #include "pycore_hashtable.h"     // _Py_hashtable_t
 #include "pycore_interp_structs.h" // _import_state
-#include "pycore_lock.h"          // PyMutex
 
 extern int _PyImport_IsInitialized(PyInterpreterState *);
 
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h
index aa20190e252a2d..02537bdfef8598 100644
--- a/Include/internal/pycore_pymem.h
+++ b/Include/internal/pycore_pymem.h
@@ -2,7 +2,6 @@
 #define Py_INTERNAL_PYMEM_H
 
 #include "pycore_llist.h"           // struct llist_node
-#include "pycore_lock.h"            // PyMutex
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/Include/internal/pycore_qsbr.h b/Include/internal/pycore_qsbr.h
index 20e643e172b38d..b835c3abaf5d0b 100644
--- a/Include/internal/pycore_qsbr.h
+++ b/Include/internal/pycore_qsbr.h
@@ -11,7 +11,6 @@
 
 #include <stdbool.h>
 #include <stdint.h>
-#include "pycore_lock.h"        // PyMutex
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/Include/internal/pycore_unicodeobject.h 
b/Include/internal/pycore_unicodeobject.h
index c22be338df48a3..34600ee6a9d1d4 100644
--- a/Include/internal/pycore_unicodeobject.h
+++ b/Include/internal/pycore_unicodeobject.h
@@ -8,7 +8,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_lock.h"          // PyMutex
 #include "pycore_fileutils.h"     // _Py_error_handler
 #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
 #include "pycore_global_objects.h"  // _Py_SINGLETON
diff --git a/Include/internal/pycore_weakref.h 
b/Include/internal/pycore_weakref.h
index 94aadb2c1547dd..950aa0af290056 100644
--- a/Include/internal/pycore_weakref.h
+++ b/Include/internal/pycore_weakref.h
@@ -9,7 +9,7 @@ extern "C" {
 #endif
 
 #include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION()
-#include "pycore_lock.h"
+#include "pycore_lock.h"             // PyMutex_LockFlags()
 #include "pycore_object.h"           // _Py_REF_IS_MERGED()
 #include "pycore_pyatomic_ft_wrappers.h"
 
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 82d84ac5bde381..09e014534fbabc 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -2368,7 +2368,7 @@ def write_internal_h_header(mod, f):
         #ifndef Py_INTERNAL_AST_STATE_H
         #define Py_INTERNAL_AST_STATE_H
 
-        #include "pycore_lock.h"    // _PyOnceFlag
+        #include "pycore_lock.h"          // _PyOnceFlag
 
         #ifdef __cplusplus
         extern "C" {

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to