@@ -14585,31 +14585,6 @@ _PyUnicode_InitTypes(PyInterpreterState *interp)
1458514585}
1458614586
1458714587
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-
1461314588void
1461414589PyUnicode_InternInPlace (PyObject * * p )
1461514590{
@@ -14633,16 +14608,15 @@ PyUnicode_InternInPlace(PyObject **p)
1463314608 return ;
1463414609 }
1463514610
14636- PyObject * t = store_interned (s );
14611+ PyObject * interned = get_interned_dict ();
14612+ PyObject * t = _Py_AddToGlobalDict (interned , s , s );
1463714613 if (t != s ) {
1463814614 if (t != NULL ) {
1463914615 Py_SETREF (* p , Py_NewRef (t ));
1464014616 }
1464114617 return ;
1464214618 }
1464314619
14644- // XXX Immortalize the object.
14645-
1464614620 /* The two references in interned dict (key and value) are not counted by
1464714621 refcnt. unicode_dealloc() and _PyUnicode_ClearInterned() take care of
1464814622 this. */
0 commit comments