Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35134: Move classobject.h to Include/cpython/ #28968

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ Porting to Python 3.11
header provides functions like ``printf()`` and ``fopen()``.
(Contributed by Victor Stinner in :issue:`45434`.)

* The non-limited API files ``cellobject.h`` and ``funcobject.h`` have been
* The non-limited API files ``cellobject.h``, ``classobject.h``, ``context.h``,
``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have been
moved to the ``Include/cpython`` directory. These files must not be included
directly, as they are already included in ``Python.h``: :ref:`Include Files
<api-includes>`. If they have been included directly, consider including
Expand Down
10 changes: 5 additions & 5 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "bytesobject.h"
#include "unicodeobject.h"
#include "longobject.h"
#include "longintrepr.h"
#include "cpython/longintrepr.h"
#include "boolobject.h"
#include "floatobject.h"
#include "complexobject.h"
Expand All @@ -61,7 +61,7 @@
#include "methodobject.h"
#include "moduleobject.h"
#include "cpython/funcobject.h"
#include "classobject.h"
#include "cpython/classobject.h"
#include "fileobject.h"
#include "pycapsule.h"
#include "code.h"
Expand All @@ -70,7 +70,8 @@
#include "sliceobject.h"
#include "cpython/cellobject.h"
#include "iterobject.h"
#include "genobject.h"
#include "pystate.h"
#include "cpython/genobject.h"
#include "descrobject.h"
#include "genericaliasobject.h"
#include "warnings.h"
Expand All @@ -83,8 +84,7 @@
#include "pyerrors.h"
#include "cpython/initconfig.h"
#include "pythread.h"
#include "pystate.h"
#include "context.h"
#include "cpython/context.h"
#include "modsupport.h"
#include "compile.h"
#include "pythonrun.h"
Expand Down
4 changes: 2 additions & 2 deletions Include/classobject.h → Include/cpython/classobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_CLASSOBJECT_H */
#endif /* Py_LIMITED_API */
#endif // !Py_CLASSOBJECT_H
#endif // !Py_LIMITED_API
7 changes: 2 additions & 5 deletions Include/context.h → Include/cpython/context.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#ifndef Py_LIMITED_API
#ifndef Py_CONTEXT_H
#define Py_CONTEXT_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_LIMITED_API


PyAPI_DATA(PyTypeObject) PyContext_Type;
typedef struct _pycontextobject PyContext;

Expand Down Expand Up @@ -73,9 +71,8 @@ PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token);
PyAPI_FUNC(PyObject *) _PyContext_NewHamtForTests(void);


#endif /* !Py_LIMITED_API */

#ifdef __cplusplus
}
#endif
#endif /* !Py_CONTEXT_H */
#endif /* !Py_LIMITED_API */
12 changes: 6 additions & 6 deletions Include/genobject.h → Include/cpython/genobject.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/* Generator object interface */

#ifndef Py_LIMITED_API
Expand All @@ -8,8 +7,7 @@
extern "C" {
#endif

#include "pystate.h" /* _PyErr_StackItem */
#include "abstract.h" /* PySendResult */
/* --- Generators --------------------------------------------------------- */

/* _PyGenObject_HEAD defines the initial segment of generator
and coroutine objects. */
Expand Down Expand Up @@ -45,7 +43,9 @@ PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
PyObject *_PyGen_yf(PyGenObject *);
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);

#ifndef Py_LIMITED_API

/* --- PyCoroObject ------------------------------------------------------- */

typedef struct {
_PyGenObject_HEAD(cr)
PyObject *cr_origin;
Expand All @@ -59,7 +59,8 @@ PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
PyObject *name, PyObject *qualname);

/* Asynchronous Generators */

/* --- Asynchronous Generators -------------------------------------------- */

typedef struct {
_PyGenObject_HEAD(ag)
Expand Down Expand Up @@ -89,7 +90,6 @@ PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,

PyObject *_PyAsyncGenValueWrapperNew(PyObject *);

#endif

#undef _PyGenObject_HEAD

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,10 @@ PYTHON_HEADERS= \
$(srcdir)/Include/bytearrayobject.h \
$(srcdir)/Include/bytesobject.h \
$(srcdir)/Include/ceval.h \
$(srcdir)/Include/classobject.h \
$(srcdir)/Include/code.h \
$(srcdir)/Include/codecs.h \
$(srcdir)/Include/compile.h \
$(srcdir)/Include/complexobject.h \
$(srcdir)/Include/context.h \
$(srcdir)/Include/descrobject.h \
$(srcdir)/Include/dictobject.h \
$(srcdir)/Include/dynamic_annotations.h \
Expand All @@ -1144,13 +1142,11 @@ PYTHON_HEADERS= \
$(srcdir)/Include/fileutils.h \
$(srcdir)/Include/floatobject.h \
$(srcdir)/Include/frameobject.h \
$(srcdir)/Include/genobject.h \
$(srcdir)/Include/import.h \
$(srcdir)/Include/interpreteridobject.h \
$(srcdir)/Include/intrcheck.h \
$(srcdir)/Include/iterobject.h \
$(srcdir)/Include/listobject.h \
$(srcdir)/Include/longintrepr.h \
$(srcdir)/Include/longobject.h \
$(srcdir)/Include/marshal.h \
$(srcdir)/Include/memoryobject.h \
Expand Down Expand Up @@ -1202,18 +1198,22 @@ PYTHON_HEADERS= \
$(srcdir)/Include/cpython/bytesobject.h \
$(srcdir)/Include/cpython/cellobject.h \
$(srcdir)/Include/cpython/ceval.h \
$(srcdir)/Include/cpython/classobject.h \
$(srcdir)/Include/cpython/code.h \
$(srcdir)/Include/cpython/compile.h \
$(srcdir)/Include/cpython/context.h \
$(srcdir)/Include/cpython/dictobject.h \
$(srcdir)/Include/cpython/fileobject.h \
$(srcdir)/Include/cpython/fileutils.h \
$(srcdir)/Include/cpython/floatobject.h \
$(srcdir)/Include/cpython/frameobject.h \
$(srcdir)/Include/cpython/funcobject.h \
$(srcdir)/Include/cpython/genobject.h \
$(srcdir)/Include/cpython/import.h \
$(srcdir)/Include/cpython/initconfig.h \
$(srcdir)/Include/cpython/interpreteridobject.h \
$(srcdir)/Include/cpython/listobject.h \
$(srcdir)/Include/cpython/longintrepr.h \
$(srcdir)/Include/cpython/methodobject.h \
$(srcdir)/Include/cpython/object.h \
$(srcdir)/Include/cpython/objimpl.h \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Move ``cellobject.h`` and ``funcobject.h`` header files from ``Include/`` to
Move ``cellobject.h``, ``classobject.h``, ``context.h``, ``funcobject.h``,
``genobject.h`` and ``longintrepr.h`` header files from ``Include/`` to
``Include/cpython/``. C extensions should only include the main ``<Python.h>``
header. Patch by Victor Stinner.
1 change: 0 additions & 1 deletion Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include <Python.h>
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "longintrepr.h"
#include "complexobject.h"
#include "mpdecimal.h"

Expand Down
1 change: 0 additions & 1 deletion Objects/abstract.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "pycore_unionobject.h" // _PyUnion_Check()
#include <ctype.h>
#include <stddef.h> // offsetof()
#include "longintrepr.h"



Expand Down
1 change: 0 additions & 1 deletion Objects/boolobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Python.h"
#include "pycore_pyerrors.h" // _Py_FatalRefcountError()
#include "longintrepr.h"

/* We define bool_repr to return "False" or "True" */

Expand Down
1 change: 0 additions & 1 deletion Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "pycore_long.h" // __PyLong_GetSmallInt_internal()
#include "pycore_object.h" // _PyObject_InitVar()
#include "pycore_pystate.h" // _Py_IsMainInterpreter()
#include "longintrepr.h"

#include <ctype.h>
#include <float.h>
Expand Down
8 changes: 4 additions & 4 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,31 @@
<ClInclude Include="..\Include\bytearrayobject.h" />
<ClInclude Include="..\Include\bytesobject.h" />
<ClInclude Include="..\Include\ceval.h" />
<ClInclude Include="..\Include\classobject.h" />
<ClInclude Include="..\Include\code.h" />
<ClInclude Include="..\Include\codecs.h" />
<ClInclude Include="..\Include\compile.h" />
<ClInclude Include="..\Include\complexobject.h" />
<ClInclude Include="..\Include\context.h" />
<ClInclude Include="..\Include\cpython\abstract.h" />
<ClInclude Include="..\Include\cpython\bytearrayobject.h" />
<ClInclude Include="..\Include\cpython\bytesobject.h" />
<ClInclude Include="..\Include\cpython\cellobject.h" />
<ClInclude Include="..\Include\cpython\ceval.h" />
<ClInclude Include="..\Include\cpython\classobject.h" />
<ClInclude Include="..\Include\cpython\code.h" />
<ClInclude Include="..\Include\cpython\compile.h" />
<ClInclude Include="..\Include\cpython\context.h" />
<ClInclude Include="..\Include\cpython\dictobject.h" />
<ClInclude Include="..\Include\cpython\fileobject.h" />
<ClInclude Include="..\Include\cpython\fileutils.h" />
<ClInclude Include="..\Include\cpython\floatobject.h" />
<ClInclude Include="..\Include\cpython\frameobject.h" />
<ClInclude Include="..\Include\cpython\funcobject.h" />
<ClInclude Include="..\Include\cpython\genobject.h" />
<ClInclude Include="..\Include\cpython\import.h" />
<ClInclude Include="..\Include\cpython\initconfig.h" />
<ClInclude Include="..\Include\cpython\interpreteridobject.h" />
<ClInclude Include="..\Include\cpython\listobject.h" />
<ClInclude Include="..\Include\cpython\longintrepr.h" />
<ClInclude Include="..\Include\cpython\methodobject.h" />
<ClInclude Include="..\Include\cpython\object.h" />
<ClInclude Include="..\Include\cpython\objimpl.h" />
Expand Down Expand Up @@ -170,7 +172,6 @@
<ClInclude Include="..\Include\fileutils.h" />
<ClInclude Include="..\Include\floatobject.h" />
<ClInclude Include="..\Include\frameobject.h" />
<ClInclude Include="..\Include\genobject.h" />
<ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\pycore_abstract.h" />
<ClInclude Include="..\Include\internal\pycore_accu.h" />
Expand Down Expand Up @@ -224,7 +225,6 @@
<ClInclude Include="..\Include\intrcheck.h" />
<ClInclude Include="..\Include\iterobject.h" />
<ClInclude Include="..\Include\listobject.h" />
<ClInclude Include="..\Include\longintrepr.h" />
<ClInclude Include="..\Include\longobject.h" />
<ClInclude Include="..\Include\marshal.h" />
<ClInclude Include="..\Include\memoryobject.h" />
Expand Down
24 changes: 12 additions & 12 deletions PCbuild/pythoncore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
<ClInclude Include="..\Include\ceval.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\classobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\code.h">
<Filter>Include</Filter>
</ClInclude>
Expand All @@ -69,9 +66,6 @@
<ClInclude Include="..\Include\complexobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\context.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\datetime.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -105,9 +99,6 @@
<ClInclude Include="..\Include\frameobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\genobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\import.h">
<Filter>Include</Filter>
</ClInclude>
Expand All @@ -120,9 +111,6 @@
<ClInclude Include="..\Include\listobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\longintrepr.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\longobject.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -375,12 +363,18 @@
<ClInclude Include="..\Include\cpython\ceval.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\classobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\code.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\compile.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\context.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\dictobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand All @@ -399,6 +393,9 @@
<ClInclude Include="..\Include\cpython\listobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\longintrepr.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\odictobject.h">
<Filter>Include</Filter>
</ClInclude>
Expand Down Expand Up @@ -456,6 +453,9 @@
<ClInclude Include="..\Include\cpython\funcobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\genobject.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\cpython\interpreteridobject.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand Down
1 change: 0 additions & 1 deletion Python/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "pycore_code.h" // _PyCode_New()
#include "pycore_floatobject.h" // _PyFloat_Pack8()
#include "pycore_hashtable.h" // _Py_hashtable_t
#include "longintrepr.h"
#include "code.h"
#include "marshal.h" // Py_MARSHAL_VERSION

Expand Down