Skip to content

Commit 5bc1b7f

Browse files
authored
gh-109693: Update pycore_interp.h to use pyatomic.h (#110604)
1 parent f5edb56 commit 5bc1b7f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Include/internal/pycore_interp.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ extern "C" {
1212

1313
#include "pycore_ast_state.h" // struct ast_state
1414
#include "pycore_atexit.h" // struct atexit_state
15-
#include "pycore_atomic.h" // _Py_atomic_address
1615
#include "pycore_ceval_state.h" // struct _ceval_state
1716
#include "pycore_code.h" // struct callable_cache
1817
#include "pycore_context.h" // struct _Py_context_state
@@ -119,7 +118,7 @@ struct _is {
119118
Use _PyInterpreterState_GetFinalizing()
120119
and _PyInterpreterState_SetFinalizing()
121120
to access it, don't access it directly. */
122-
_Py_atomic_address _finalizing;
121+
PyThreadState* _finalizing;
123122
/* The ID of the OS thread in which we are finalizing. */
124123
unsigned long _finalizing_id;
125124

@@ -244,7 +243,7 @@ extern void _PyInterpreterState_Clear(PyThreadState *tstate);
244243

245244
static inline PyThreadState*
246245
_PyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
247-
return (PyThreadState*)_Py_atomic_load_relaxed(&interp->_finalizing);
246+
return (PyThreadState*)_Py_atomic_load_ptr_relaxed(&interp->_finalizing);
248247
}
249248

250249
static inline unsigned long
@@ -254,7 +253,7 @@ _PyInterpreterState_GetFinalizingID(PyInterpreterState *interp) {
254253

255254
static inline void
256255
_PyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tstate) {
257-
_Py_atomic_store_relaxed(&interp->_finalizing, (uintptr_t)tstate);
256+
_Py_atomic_store_ptr_relaxed(&interp->_finalizing, tstate);
258257
if (tstate == NULL) {
259258
_Py_atomic_store_ulong_relaxed(&interp->_finalizing_id, 0);
260259
}

0 commit comments

Comments
 (0)