@@ -14585,31 +14585,6 @@ _PyUnicode_InitTypes(PyInterpreterState *interp)
14585
14585
}
14586
14586
14587
14587
14588
- static inline PyObject *
14589
- store_interned (PyObject * obj )
14590
- {
14591
- PyObject * interned = get_interned_dict ();
14592
- assert (interned != NULL );
14593
-
14594
- /* Swap to the main interpreter, if necessary. */
14595
- PyInterpreterState * interp = _PyInterpreterState_GET ();
14596
- PyThreadState * oldts = _Py_AcquireGlobalObjectsState (interp );
14597
-
14598
- /* This might trigger a resize, which is why we must "acquire"
14599
- the global object state. */
14600
- PyObject * t = PyDict_SetDefault (interned , obj , obj );
14601
- if (t == NULL ) {
14602
- PyErr_Clear ();
14603
- }
14604
-
14605
- /* Swap back. */
14606
- if (oldts != NULL ) {
14607
- _Py_ReleaseGlobalObjectsState (oldts );
14608
- }
14609
-
14610
- return t ;
14611
- }
14612
-
14613
14588
void
14614
14589
PyUnicode_InternInPlace (PyObject * * p )
14615
14590
{
@@ -14633,16 +14608,15 @@ PyUnicode_InternInPlace(PyObject **p)
14633
14608
return ;
14634
14609
}
14635
14610
14636
- PyObject * t = store_interned (s );
14611
+ PyObject * interned = get_interned_dict ();
14612
+ PyObject * t = _Py_AddToGlobalDict (interned , s , s );
14637
14613
if (t != s ) {
14638
14614
if (t != NULL ) {
14639
14615
Py_SETREF (* p , Py_NewRef (t ));
14640
14616
}
14641
14617
return ;
14642
14618
}
14643
14619
14644
- // XXX Immortalize the object.
14645
-
14646
14620
/* The two references in interned dict (key and value) are not counted by
14647
14621
refcnt. unicode_dealloc() and _PyUnicode_ClearInterned() take care of
14648
14622
this. */
0 commit comments