mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
bpo-45459: Add pytypedefs.h header file (GH-31527)
Move forward declarations of Python C API types to a new pytypedefs.h header file to solve interdependency issues between header files. pytypedefs.h contains forward declarations of the following types: * PyCodeObject * PyFrameObject * PyGetSetDef * PyInterpreterState * PyLongObject * PyMemberDef * PyMethodDef * PyModuleDef * PyObject * PyThreadState * PyTypeObject
This commit is contained in:
parent
a52d2528a4
commit
ec091bd47e
16 changed files with 44 additions and 40 deletions
29
Include/pytypedefs.h
Normal file
29
Include/pytypedefs.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Forward declarations of types of the Python C API.
|
||||
// Declare them at the same place since redefining typedef is a C11 feature.
|
||||
// Only use a forward declaration if there is an interdependency between two
|
||||
// header files.
|
||||
|
||||
#ifndef Py_PYTYPEDEFS_H
|
||||
#define Py_PYTYPEDEFS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct PyModuleDef PyModuleDef;
|
||||
typedef struct PyMethodDef PyMethodDef;
|
||||
typedef struct PyGetSetDef PyGetSetDef;
|
||||
typedef struct PyMemberDef PyMemberDef;
|
||||
|
||||
typedef struct _object PyObject;
|
||||
typedef struct _longobject PyLongObject;
|
||||
typedef struct _typeobject PyTypeObject;
|
||||
typedef struct PyCodeObject PyCodeObject;
|
||||
typedef struct _frame PyFrameObject;
|
||||
|
||||
typedef struct _ts PyThreadState;
|
||||
typedef struct _is PyInterpreterState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // !Py_PYTYPEDEFS_H
|
Loading…
Add table
Add a link
Reference in a new issue