From 828aad97137c876b9a41fb4c3b2f6d5151184717 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 30 Apr 2026 16:05:25 +0200 Subject: [PATCH] gh-148829: Move sentinelobject.h to Include/cpython/ This C API is not part of the limited C API, so move it to the CPython C API. --- Include/Python.h | 2 +- Include/{ => cpython}/sentinelobject.h | 4 ++-- Makefile.pre.in | 2 +- PCbuild/pythoncore.vcxproj | 2 +- PCbuild/pythoncore.vcxproj.filters | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) rename Include/{ => cpython}/sentinelobject.h (93%) diff --git a/Include/Python.h b/Include/Python.h index 1272e2464f91d1..d5e38b8b0201ee 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -117,7 +117,7 @@ __pragma(warning(disable: 4201)) #include "cpython/genobject.h" #include "descrobject.h" #include "genericaliasobject.h" -#include "sentinelobject.h" +#include "cpython/sentinelobject.h" #include "warnings.h" #include "weakrefobject.h" #include "structseq.h" diff --git a/Include/sentinelobject.h b/Include/cpython/sentinelobject.h similarity index 93% rename from Include/sentinelobject.h rename to Include/cpython/sentinelobject.h index 9d8577767b7485..0b6ff0f17e6f8c 100644 --- a/Include/sentinelobject.h +++ b/Include/cpython/sentinelobject.h @@ -1,12 +1,12 @@ /* Sentinel object interface */ +#ifndef Py_LIMITED_API #ifndef Py_SENTINELOBJECT_H #define Py_SENTINELOBJECT_H #ifdef __cplusplus extern "C" { #endif -#ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) PySentinel_Type; #define PySentinel_Check(op) Py_IS_TYPE((op), &PySentinel_Type) @@ -14,9 +14,9 @@ PyAPI_DATA(PyTypeObject) PySentinel_Type; PyAPI_FUNC(PyObject *) PySentinel_New( const char *name, const char *module_name); -#endif #ifdef __cplusplus } #endif #endif /* !Py_SENTINELOBJECT_H */ +#endif /* !Py_LIMITED_API */ diff --git a/Makefile.pre.in b/Makefile.pre.in index 2ce53c6a816212..0edf55d991a05e 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1241,7 +1241,6 @@ PYTHON_HEADERS= \ $(srcdir)/Include/pytypedefs.h \ $(srcdir)/Include/rangeobject.h \ $(srcdir)/Include/refcount.h \ - $(srcdir)/Include/sentinelobject.h \ $(srcdir)/Include/setobject.h \ $(srcdir)/Include/sliceobject.h \ $(srcdir)/Include/structmember.h \ @@ -1309,6 +1308,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/cpython/pystats.h \ $(srcdir)/Include/cpython/pythonrun.h \ $(srcdir)/Include/cpython/pythread.h \ + $(srcdir)/Include/cpython/sentinelobject.h \ $(srcdir)/Include/cpython/setobject.h \ $(srcdir)/Include/cpython/sliceobject.h \ $(srcdir)/Include/cpython/structseq.h \ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index fb9217fee8bd73..fae4a90b4536fc 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -195,6 +195,7 @@ + @@ -384,7 +385,6 @@ - diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 1e1d085cd75511..04b6641ae30e7f 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -222,9 +222,6 @@ Include - - Include - Include @@ -522,6 +519,9 @@ Include\cpython + + Include + Include\cpython