bpo-38353: Cleanup includes in the internal C API (GH-16548) · python/cpython@61691d8

16 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -8,8 +8,7 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "dynamic_annotations.h"

12-
11+

#include "dynamic_annotations.h" /* _Py_ANNOTATE_MEMORY_ORDER */

1312

#include "pyconfig.h"

1413
1514

#if defined(HAVE_STD_ATOMIC)

Original file line numberDiff line numberDiff line change

@@ -8,9 +8,9 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pycore_atomic.h"

12-

#include "pycore_pystate.h"

13-

#include "pythread.h"

11+

/* Forward declarations */

12+

typedef struct pyruntimestate _PyRuntimeState;

13+

struct _ceval_runtime_state;

1414
1515

PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime);

1616

PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);

Original file line numberDiff line numberDiff line change

@@ -5,7 +5,7 @@

55

# error "this header requires Py_BUILD_CORE define"

66

#endif

77
8-

#include "pycore_hamt.h"

8+

#include "pycore_hamt.h" /* PyHamtObject */

99
1010

struct _pycontextobject {

1111

PyObject_HEAD

Original file line numberDiff line numberDiff line change

@@ -8,8 +8,8 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pycore_condvar.h"

12-

#include "pycore_atomic.h"

11+

#include "pycore_atomic.h" /* _Py_atomic_address */

12+

#include "pycore_condvar.h" /* PyCOND_T */

1313
1414

#ifndef Py_HAVE_CONDVAR

1515

# error You need either a POSIX-compatible or a Windows system!

Original file line numberDiff line numberDiff line change

@@ -8,7 +8,8 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pycore_pystate.h" /* _PyRuntimeState */

11+

/* Forward declaration */

12+

typedef struct pyruntimestate _PyRuntimeState;

1213
1314

/* --- PyStatus ----------------------------------------------- */

1415

@@ -60,7 +61,7 @@ PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list);

6061
6162

/* --- _PyArgv ---------------------------------------------------- */

6263
63-

typedef struct {

64+

typedef struct _PyArgv {

6465

Py_ssize_t argc;

6566

int use_bytes_argv;

6667

char * const *bytes_argv;

Original file line numberDiff line numberDiff line change

@@ -8,7 +8,7 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pycore_pystate.h" /* _PyRuntime */

11+

#include "pycore_pystate.h" /* _PyRuntime.gc */

1212
1313

PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);

1414

PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content);

Original file line numberDiff line numberDiff line change

@@ -8,8 +8,9 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pycore_initconfig.h" /* _PyArgv */

12-

#include "pycore_pystate.h" /* _PyRuntimeState */

11+

/* Forward declarations */

12+

typedef struct _PyArgv _PyArgv;

13+

typedef struct pyruntimestate _PyRuntimeState;

1314
1415

/* True if the main interpreter thread exited due to an unhandled

1516

* KeyboardInterrupt exception, suggesting the user pressed ^C. */

Original file line numberDiff line numberDiff line change

@@ -8,8 +8,7 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "objimpl.h"

12-

#include "pymem.h"

11+

#include "pymem.h" /* PyMemAllocatorName */

1312
1413
1514

/* GC runtime state */

Original file line numberDiff line numberDiff line change

@@ -8,16 +8,9 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "cpython/initconfig.h"

12-

#include "fileobject.h"

13-

#include "pystate.h"

14-

#include "pythread.h"

15-

#include "sysmodule.h"

16-
17-

#include "pycore_gil.h" /* _gil_runtime_state */

18-

#include "pycore_pathconfig.h"

19-

#include "pycore_pymem.h"

20-

#include "pycore_warnings.h"

11+

#include "pycore_gil.h" /* struct _gil_runtime_state */

12+

#include "pycore_pymem.h" /* struct _gc_runtime_state */

13+

#include "pycore_warnings.h" /* struct _warnings_runtime_state */

2114
2215
2316

/* ceval state */

Original file line numberDiff line numberDiff line change

@@ -8,7 +8,8 @@ extern "C" {

88

# error "this header requires Py_BUILD_CORE define"

99

#endif

1010
11-

#include "pystate.h" /* PyInterpreterState */

11+

/* Forward declaration */

12+

typedef struct _is PyInterpreterState;

1213
1314

/* Write the Python traceback into the file 'fd'. For example:

1415