File tree 4 files changed +24
-1
lines changed 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
299
299
Unicode object without initial data.
300
300
(Contributed by Inada Naoki in :issue: `36346 `.)
301
301
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
+
302
310
Removed
303
311
-------
304
312
Original file line number Diff line number Diff line change @@ -261,11 +261,14 @@ PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(
261
261
);
262
262
263
263
PyAPI_FUNC (void ) PyUnicode_InternInPlace (PyObject * * );
264
- PyAPI_FUNC (void ) PyUnicode_InternImmortal (PyObject * * );
265
264
PyAPI_FUNC (PyObject * ) PyUnicode_InternFromString (
266
265
const char * u /* UTF-8 encoded string */
267
266
);
268
267
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
+
269
272
/* Use only if you know it's a string */
270
273
#define PyUnicode_CHECK_INTERNED (op ) \
271
274
(((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)
15764
15764
void
15765
15765
PyUnicode_InternImmortal (PyObject * * p )
15766
15766
{
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
+
15767
15776
PyUnicode_InternInPlace (p );
15768
15777
if (PyUnicode_CHECK_INTERNED (* p ) != SSTATE_INTERNED_IMMORTAL ) {
15769
15778
_PyUnicode_STATE (* p ).interned = SSTATE_INTERNED_IMMORTAL ;
You can’t perform that action at this time.
0 commit comments