gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (#121364)

* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs

* Document immortality in some functions that take `const char *`

This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.

Always point out a non-immortalizing alternative.

* Don't immortalize user-provided attr names in _ctypes
This commit is contained in:
Petr Viktorin 2024-07-16 15:36:21 +02:00 committed by GitHub
parent d7a099d7ae
commit b4aedb23ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 82 additions and 10 deletions

View file

@ -15584,7 +15584,7 @@ void
PyUnicode_InternInPlace(PyObject **p)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
_PyUnicode_InternImmortal(interp, p);
_PyUnicode_InternMortal(interp, p);
}
// Public-looking name kept for the stable ABI; user should not call this: