Skip to content

Commit 37b1d60

Browse files
authored
po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)
Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.
1 parent 7076bef commit 37b1d60

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

Doc/whatsnew/3.11.rst

+6
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,12 @@ Porting to Python 3.11
572572
header provides functions like ``printf()`` and ``fopen()``.
573573
(Contributed by Victor Stinner in :issue:`45434`.)
574574

575+
* The non-limited API file ``funcobject.h`` has been moved to the
576+
``Include/cpython`` directory. This file must not be included directly, as it
577+
is already included in ``Python.h``: :ref:`Include Files <api-includes>`. If
578+
it has been included directly, consider including ``Python.h`` instead.
579+
(Contributed by Victor Stinner in :issue:`35134`.)
580+
575581
Deprecated
576582
----------
577583

Include/Python.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#include "setobject.h"
6161
#include "methodobject.h"
6262
#include "moduleobject.h"
63-
#include "funcobject.h"
63+
#include "cpython/funcobject.h"
6464
#include "classobject.h"
6565
#include "fileobject.h"
6666
#include "pycapsule.h"

Include/funcobject.h renamed to Include/cpython/funcobject.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
/* Function object interface */
2+
33
#ifndef Py_LIMITED_API
44
#ifndef Py_FUNCOBJECT_H
55
#define Py_FUNCOBJECT_H
@@ -76,15 +76,13 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
7676
PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *);
7777
PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
7878

79-
#ifndef Py_LIMITED_API
8079
PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall(
8180
PyObject *func,
8281
PyObject *const *stack,
8382
size_t nargsf,
8483
PyObject *kwnames);
8584

8685
uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
87-
#endif
8886

8987
/* Macros for direct access to these values. Type checks are *not*
9088
done, so use with care. */

Makefile.pre.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ PYTHON_HEADERS= \
11451145
$(srcdir)/Include/fileutils.h \
11461146
$(srcdir)/Include/floatobject.h \
11471147
$(srcdir)/Include/frameobject.h \
1148-
$(srcdir)/Include/funcobject.h \
11491148
$(srcdir)/Include/genobject.h \
11501149
$(srcdir)/Include/import.h \
11511150
$(srcdir)/Include/interpreteridobject.h \
@@ -1210,6 +1209,7 @@ PYTHON_HEADERS= \
12101209
$(srcdir)/Include/cpython/fileutils.h \
12111210
$(srcdir)/Include/cpython/floatobject.h \
12121211
$(srcdir)/Include/cpython/frameobject.h \
1212+
$(srcdir)/Include/cpython/funcobject.h \
12131213
$(srcdir)/Include/cpython/import.h \
12141214
$(srcdir)/Include/cpython/initconfig.h \
12151215
$(srcdir)/Include/cpython/interpreteridobject.h \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Move Include/funcobject.h header file to Include/cpython/funcobject.h.
2+
C extensions should only include the main ``<Python.h>`` header.
3+
Patch by Victor Stinner.

PCbuild/pythoncore.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
<ClInclude Include="..\Include\cpython\fileutils.h" />
135135
<ClInclude Include="..\Include\cpython\floatobject.h" />
136136
<ClInclude Include="..\Include\cpython\frameobject.h" />
137+
<ClInclude Include="..\Include\cpython\funcobject.h" />
137138
<ClInclude Include="..\Include\cpython\import.h" />
138139
<ClInclude Include="..\Include\cpython\initconfig.h" />
139140
<ClInclude Include="..\Include\cpython\interpreteridobject.h" />
@@ -169,7 +170,6 @@
169170
<ClInclude Include="..\Include\fileutils.h" />
170171
<ClInclude Include="..\Include\floatobject.h" />
171172
<ClInclude Include="..\Include\frameobject.h" />
172-
<ClInclude Include="..\Include\funcobject.h" />
173173
<ClInclude Include="..\Include\genobject.h" />
174174
<ClInclude Include="..\Include\import.h" />
175175
<ClInclude Include="..\Include\internal\pycore_abstract.h" />

PCbuild/pythoncore.vcxproj.filters

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@
108108
<ClInclude Include="..\Include\frameobject.h">
109109
<Filter>Include</Filter>
110110
</ClInclude>
111-
<ClInclude Include="..\Include\funcobject.h">
112-
<Filter>Include</Filter>
113-
</ClInclude>
114111
<ClInclude Include="..\Include\genobject.h">
115112
<Filter>Include</Filter>
116113
</ClInclude>
@@ -456,6 +453,9 @@
456453
<ClInclude Include="..\Include\cpython\frameobject.h">
457454
<Filter>Include\cpython</Filter>
458455
</ClInclude>
456+
<ClInclude Include="..\Include\cpython\funcobject.h">
457+
<Filter>Include\cpython</Filter>
458+
</ClInclude>
459459
<ClInclude Include="..\Include\cpython\interpreteridobject.h">
460460
<Filter>Include\cpython</Filter>
461461
</ClInclude>

Tools/scripts/stable_abi.py

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"datetime.h",
3535
"dtoa.h",
3636
"frameobject.h",
37-
"funcobject.h",
3837
"genobject.h",
3938
"longintrepr.h",
4039
"parsetok.h",

0 commit comments

Comments
 (0)