bpo-36737: Use the module state C-API for warnings. (gh-13159) · python/cpython@86ea581

File tree

6 files changed

lines changed

  • Misc/NEWS.d/next/Core and Builtins

6 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -81,7 +81,7 @@ extern void PyLong_Fini(void);

8181

extern void _PyFaulthandler_Fini(void);

8282

extern void _PyHash_Fini(void);

8383

extern int _PyTraceMalloc_Fini(void);

84-

extern void _PyWarnings_Fini(_PyRuntimeState *runtime);

84+

extern void _PyWarnings_Fini(PyInterpreterState *interp);

8585
8686

extern void _PyGILState_Init(

8787

_PyRuntimeState *runtime,

Original file line numberDiff line numberDiff line change

@@ -90,6 +90,8 @@ struct _is {

9090

PyObject *pyexitmodule;

9191
9292

uint64_t tstate_next_unique_id;

93+
94+

struct _warnings_runtime_state warnings;

9395

};

9496
9597

PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T);

@@ -179,7 +181,6 @@ typedef struct pyruntimestate {

179181

int nexitfuncs;

180182
181183

struct _gc_runtime_state gc;

182-

struct _warnings_runtime_state warnings;

183184

struct _ceval_runtime_state ceval;

184185

struct _gilstate_runtime_state gilstate;

185186
Original file line numberDiff line numberDiff line change

@@ -0,0 +1,2 @@

1+

Move PyRuntimeState.warnings into per-interpreter state (via "module

2+

state").