Skip to content

Commit 063abd9

Browse files
authored
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
Move the interpreteridobject.h header file from Include/ to Include/internal/. It only provides private functions.
1 parent 59a633d commit 063abd9

File tree

11 files changed

+26
-35
lines changed

11 files changed

+26
-35
lines changed
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
#ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H
2-
# error "this header file must not be included directly"
1+
/* Interpreter ID Object */
2+
3+
#ifndef Py_INTERNAL_INTERPRETERIDOBJECT_H
4+
#define Py_INTERNAL_INTERPRETERIDOBJECT_H
5+
#ifdef __cplusplus
6+
extern "C" {
37
#endif
48

5-
/* Interpreter ID Object */
9+
#ifndef Py_BUILD_CORE
10+
# error "this header requires Py_BUILD_CORE define"
11+
#endif
612

713
PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
814

915
PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
1016
PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
1117
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
18+
19+
#ifdef __cplusplus
20+
}
21+
#endif
22+
#endif // !Py_INTERNAL_INTERPRETERIDOBJECT_H

Include/internal/pycore_pymem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ void _PyObject_VirtualFree(void *, size_t size);
103103
#ifdef __cplusplus
104104
}
105105
#endif
106-
#endif /* !Py_INTERNAL_PYMEM_H */
106+
#endif // !Py_INTERNAL_PYMEM_H

Include/interpreteridobject.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

Makefile.pre.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,6 @@ PYTHON_HEADERS= \
11431143
$(srcdir)/Include/floatobject.h \
11441144
$(srcdir)/Include/frameobject.h \
11451145
$(srcdir)/Include/import.h \
1146-
$(srcdir)/Include/interpreteridobject.h \
11471146
$(srcdir)/Include/intrcheck.h \
11481147
$(srcdir)/Include/iterobject.h \
11491148
$(srcdir)/Include/listobject.h \
@@ -1211,7 +1210,6 @@ PYTHON_HEADERS= \
12111210
$(srcdir)/Include/cpython/genobject.h \
12121211
$(srcdir)/Include/cpython/import.h \
12131212
$(srcdir)/Include/cpython/initconfig.h \
1214-
$(srcdir)/Include/cpython/interpreteridobject.h \
12151213
$(srcdir)/Include/cpython/listobject.h \
12161214
$(srcdir)/Include/cpython/longintrepr.h \
12171215
$(srcdir)/Include/cpython/methodobject.h \
@@ -1260,6 +1258,7 @@ PYTHON_HEADERS= \
12601258
$(srcdir)/Include/internal/pycore_import.h \
12611259
$(srcdir)/Include/internal/pycore_initconfig.h \
12621260
$(srcdir)/Include/internal/pycore_interp.h \
1261+
$(srcdir)/Include/internal/pycore_interpreteridobject.h \
12631262
$(srcdir)/Include/internal/pycore_list.h \
12641263
$(srcdir)/Include/internal/pycore_long.h \
12651264
$(srcdir)/Include/internal/pycore_moduleobject.h \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Move the ``interpreteridobject.h`` header file from ``Include/`` to
2+
``Include/internal/``. It only provides private functions. Patch by Victor
3+
Stinner.

Modules/_xxsubinterpretersmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "frameobject.h"
77
#include "pycore_frame.h"
88
#include "pycore_pystate.h" // _PyThreadState_GET()
9-
#include "interpreteridobject.h"
9+
#include "pycore_interpreteridobject.h"
1010

1111

1212
static char *

Objects/interpreteridobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "Python.h"
44
#include "pycore_abstract.h" // _PyIndex_Check()
55
#include "pycore_interp.h" // _PyInterpreterState_LookUpID()
6-
#include "interpreteridobject.h"
6+
#include "pycore_interpreteridobject.h"
77

88

99
typedef struct interpid {

Objects/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "pycore_symtable.h" // PySTEntry_Type
1717
#include "pycore_unionobject.h" // _PyUnion_Type
1818
#include "frameobject.h" // PyFrame_Type
19-
#include "interpreteridobject.h" // _PyInterpreterID_Type
19+
#include "pycore_interpreteridobject.h" // _PyInterpreterID_Type
2020

2121
#ifdef Py_LIMITED_API
2222
// Prevent recursive call _Py_IncRef() <=> Py_INCREF()

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@
138138
<ClInclude Include="..\Include\cpython\genobject.h" />
139139
<ClInclude Include="..\Include\cpython\import.h" />
140140
<ClInclude Include="..\Include\cpython\initconfig.h" />
141-
<ClInclude Include="..\Include\cpython\interpreteridobject.h" />
142141
<ClInclude Include="..\Include\cpython\listobject.h" />
143142
<ClInclude Include="..\Include\cpython\longintrepr.h" />
144143
<ClInclude Include="..\Include\cpython\methodobject.h" />
@@ -200,6 +199,7 @@
200199
<ClInclude Include="..\Include\internal\pycore_import.h" />
201200
<ClInclude Include="..\Include\internal\pycore_initconfig.h" />
202201
<ClInclude Include="..\Include\internal\pycore_interp.h" />
202+
<ClInclude Include="..\Include\internal\pycore_interpreteridobject.h" />
203203
<ClInclude Include="..\Include\internal\pycore_list.h" />
204204
<ClInclude Include="..\Include\internal\pycore_long.h" />
205205
<ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
@@ -221,7 +221,6 @@
221221
<ClInclude Include="..\Include\internal\pycore_ucnhash.h" />
222222
<ClInclude Include="..\Include\internal\pycore_unionobject.h" />
223223
<ClInclude Include="..\Include\internal\pycore_warnings.h" />
224-
<ClInclude Include="..\Include\interpreteridobject.h" />
225224
<ClInclude Include="..\Include\intrcheck.h" />
226225
<ClInclude Include="..\Include\iterobject.h" />
227226
<ClInclude Include="..\Include\listobject.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,6 @@
333333
<ClInclude Include="..\Include\namespaceobject.h">
334334
<Filter>Include</Filter>
335335
</ClInclude>
336-
<ClInclude Include="..\Include\interpreteridobject.h">
337-
<Filter>Include</Filter>
338-
</ClInclude>
339336
<ClInclude Include="..\Modules\hashtable.h">
340337
<Filter>Modules</Filter>
341338
</ClInclude>
@@ -456,9 +453,6 @@
456453
<ClInclude Include="..\Include\cpython\genobject.h">
457454
<Filter>Include</Filter>
458455
</ClInclude>
459-
<ClInclude Include="..\Include\cpython\interpreteridobject.h">
460-
<Filter>Include\cpython</Filter>
461-
</ClInclude>
462456
<ClInclude Include="..\Include\cpython\pythonrun.h">
463457
<Filter>Include\cpython</Filter>
464458
</ClInclude>
@@ -555,6 +549,9 @@
555549
<ClInclude Include="..\Include\internal\pycore_interp.h">
556550
<Filter>Include\internal</Filter>
557551
</ClInclude>
552+
<ClInclude Include="..\Include\internal\pycore_interpreteridobject.h">
553+
<Filter>Include\cpython</Filter>
554+
</ClInclude>
558555
<ClInclude Include="..\Include\internal\pycore_list.h">
559556
<Filter>Include\internal</Filter>
560557
</ClInclude>

Tools/c-analyzer/cpython/_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def clean_lines(text):
172172
Include/cpython/fileutils.h Py_CPYTHON_FILEUTILS_H 1
173173
Include/cpython/frameobject.h Py_CPYTHON_FRAMEOBJECT_H 1
174174
Include/cpython/import.h Py_CPYTHON_IMPORT_H 1
175-
Include/cpython/interpreteridobject.h Py_CPYTHON_INTERPRETERIDOBJECT_H 1
176175
Include/cpython/listobject.h Py_CPYTHON_LISTOBJECT_H 1
177176
Include/cpython/methodobject.h Py_CPYTHON_METHODOBJECT_H 1
178177
Include/cpython/object.h Py_CPYTHON_OBJECT_H 1

0 commit comments

Comments
 (0)