mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-128972: Add _Py_ALIGN_AS
and revert PyASCIIObject
memory layout. (GH-133085)
Add `_Py_ALIGN_AS` as per C API WG vote: https://github.com/capi-workgroup/decisions/issues/61 This patch only adds it to free-threaded builds; the `#ifdef Py_GIL_DISABLED` can be removed in the future. Use this to revert `PyASCIIObject` memory layout for non-free-threaded builds. The long-term plan is to deprecate the entire struct; until that happens it's better to keep it unchanged, as courtesy to people that rely on it despite it not being stable ABI.
This commit is contained in:
parent
d78768e3d6
commit
987e45e632
4 changed files with 67 additions and 13 deletions
|
@ -15918,7 +15918,7 @@ immortalize_interned(PyObject *s)
|
|||
_Py_DecRefTotal(_PyThreadState_GET());
|
||||
}
|
||||
#endif
|
||||
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_IMMORTAL);
|
||||
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_IMMORTAL);
|
||||
_Py_SetImmortal(s);
|
||||
}
|
||||
|
||||
|
@ -16036,7 +16036,7 @@ intern_common(PyInterpreterState *interp, PyObject *s /* stolen */,
|
|||
Py_DECREF(s);
|
||||
Py_DECREF(s);
|
||||
}
|
||||
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_MORTAL);
|
||||
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_MORTAL);
|
||||
|
||||
/* INTERNED_MORTAL -> INTERNED_IMMORTAL (if needed) */
|
||||
|
||||
|
@ -16172,7 +16172,7 @@ _PyUnicode_ClearInterned(PyInterpreterState *interp)
|
|||
Py_UNREACHABLE();
|
||||
}
|
||||
if (!shared) {
|
||||
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_NOT_INTERNED);
|
||||
FT_ATOMIC_STORE_UINT8_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_NOT_INTERNED);
|
||||
}
|
||||
}
|
||||
#ifdef INTERNED_STATS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue