File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,14 @@ Porting to Python 3.10
299299 Unicode object without initial data.
300300 (Contributed by Inada Naoki in :issue: `36346 `.)
301301
302+ Deprecated
303+ ----------
304+
305+ * The ``PyUnicode_InternImmortal() `` function is now deprecated
306+ and will be removed in Python 3.12: use :c:func: `PyUnicode_InternInPlace `
307+ instead.
308+ (Contributed by Victor Stinner in :issue: `41692 `.)
309+
302310Removed
303311-------
304312
Original file line number Diff line number Diff line change @@ -261,11 +261,14 @@ PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(
261261 );
262262
263263PyAPI_FUNC (void ) PyUnicode_InternInPlace (PyObject * * );
264- PyAPI_FUNC (void ) PyUnicode_InternImmortal (PyObject * * );
265264PyAPI_FUNC (PyObject * ) PyUnicode_InternFromString (
266265 const char * u /* UTF-8 encoded string */
267266 );
268267
268+ // PyUnicode_InternImmortal() is deprecated since Python 3.10
269+ // and will be removed in Python 3.12. Use PyUnicode_InternInPlace() instead.
270+ Py_DEPRECATED (3.10 ) PyAPI_FUNC (void ) PyUnicode_InternImmortal (PyObject * * );
271+
269272/* Use only if you know it's a string */
270273#define PyUnicode_CHECK_INTERNED (op ) \
271274 (((PyASCIIObject *)(op))->state.interned)
Original file line number Diff line number Diff line change 1+ The ``PyUnicode_InternImmortal() `` function is now deprecated and will be
2+ removed in Python 3.12: use :c:func: `PyUnicode_InternInPlace ` instead.
3+ Patch by Victor Stinner.
Original file line number Diff line number Diff line change @@ -15764,6 +15764,15 @@ PyUnicode_InternInPlace(PyObject **p)
1576415764void
1576515765PyUnicode_InternImmortal (PyObject * * p )
1576615766{
15767+ if (PyErr_WarnEx (PyExc_DeprecationWarning ,
15768+ "PyUnicode_InternImmortal() is deprecated; "
15769+ "use PyUnicode_InternInPlace() instead" , 1 ) < 0 )
15770+ {
15771+ // The function has no return value, the exception cannot
15772+ // be reported to the caller, so just log it.
15773+ PyErr_WriteUnraisable (NULL );
15774+ }
15775+
1576715776 PyUnicode_InternInPlace (p );
1576815777 if (PyUnicode_CHECK_INTERNED (* p ) != SSTATE_INTERNED_IMMORTAL ) {
1576915778 _PyUnicode_STATE (* p ).interned = SSTATE_INTERNED_IMMORTAL ;
You can’t perform that action at this time.
0 commit comments