https://github.com/python/cpython/commit/14d3974db01b6c4b14a4829b4310b2511993aa8e commit: 14d3974db01b6c4b14a4829b4310b2511993aa8e branch: main author: Victor Stinner <[email protected]> committer: encukou <[email protected]> date: 2025-12-15T14:25:30+01:00 summary:
gh-142217: Recommend PyUnicode_InternFromString() to replace _PyUnicode_FromId() (GH-142746) files: M Doc/deprecations/c-api-pending-removal-in-3.20.rst M Doc/whatsnew/3.15.rst M Misc/NEWS.d/next/C_API/2025-12-03-14-41-07.gh-issue-141049.VuAUe2.rst diff --git a/Doc/deprecations/c-api-pending-removal-in-3.20.rst b/Doc/deprecations/c-api-pending-removal-in-3.20.rst index a813cb21dd4dbf..8de55bbe7e695c 100644 --- a/Doc/deprecations/c-api-pending-removal-in-3.20.rst +++ b/Doc/deprecations/c-api-pending-removal-in-3.20.rst @@ -3,7 +3,7 @@ Pending removal in Python 3.20 * :c:func:`!_PyObject_CallMethodId`, :c:func:`!_PyObject_GetAttrId` and :c:func:`!_PyUnicode_FromId` are deprecated since 3.15 and will be removed in - 3.20. Instead, use :c:func:`PyUnicode_FromString()` and cache the result in + 3.20. Instead, use :c:func:`PyUnicode_InternFromString()` and cache the result in the module state, then call :c:func:`PyObject_CallMethod` or :c:func:`PyObject_GetAttr`. (Contributed by Victor Stinner in :gh:`141049`.) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index ccf6c76f1e0fa5..19762584ef798c 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -1226,7 +1226,7 @@ Deprecated C APIs * :c:func:`!_PyObject_CallMethodId`, :c:func:`!_PyObject_GetAttrId` and :c:func:`!_PyUnicode_FromId` are deprecated since 3.15 and will be removed in - 3.20. Instead, use :c:func:`PyUnicode_FromString()` and cache the result in + 3.20. Instead, use :c:func:`PyUnicode_InternFromString()` and cache the result in the module state, then call :c:func:`PyObject_CallMethod` or :c:func:`PyObject_GetAttr`. (Contributed by Victor Stinner in :gh:`141049`.) diff --git a/Misc/NEWS.d/next/C_API/2025-12-03-14-41-07.gh-issue-141049.VuAUe2.rst b/Misc/NEWS.d/next/C_API/2025-12-03-14-41-07.gh-issue-141049.VuAUe2.rst index b0fcd24d414270..77cd5220d52fef 100644 --- a/Misc/NEWS.d/next/C_API/2025-12-03-14-41-07.gh-issue-141049.VuAUe2.rst +++ b/Misc/NEWS.d/next/C_API/2025-12-03-14-41-07.gh-issue-141049.VuAUe2.rst @@ -1,5 +1,5 @@ :c:func:`!_PyObject_CallMethodId`, :c:func:`!_PyObject_GetAttrId` and :c:func:`!_PyUnicode_FromId` are deprecated since 3.15 and will be removed in -3.20. Instead, use :c:func:`PyUnicode_FromString()` and cache the result in +3.20. Instead, use :c:func:`PyUnicode_InternFromString()` and cache the result in the module state, then call :c:func:`PyObject_CallMethod` or :c:func:`PyObject_GetAttr`. Patch by Victor Stinner. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
