File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -14533,6 +14533,15 @@ _PyUnicode_InitGlobalObjects(PyInterpreterState *interp)
14533
14533
return _PyStatus_OK ();
14534
14534
}
14535
14535
14536
+ // Initialize the global interned dict
14537
+ PyObject * interned = PyDict_New ();
14538
+ if (interned == NULL ) {
14539
+ PyErr_Clear ();
14540
+ return _PyStatus_ERR ("failed to create interned dict" );
14541
+ }
14542
+
14543
+ set_interned_dict (interned );
14544
+
14536
14545
/* Intern statically allocated string identifiers and deepfreeze strings.
14537
14546
* This must be done before any module initialization so that statically
14538
14547
* allocated string identifiers are used instead of heap allocated strings.
@@ -14600,14 +14609,7 @@ PyUnicode_InternInPlace(PyObject **p)
14600
14609
}
14601
14610
14602
14611
PyObject * interned = get_interned_dict ();
14603
- if (interned == NULL ) {
14604
- interned = PyDict_New ();
14605
- if (interned == NULL ) {
14606
- PyErr_Clear (); /* Don't leave an exception */
14607
- return ;
14608
- }
14609
- set_interned_dict (interned );
14610
- }
14612
+ assert (interned != NULL );
14611
14613
14612
14614
PyObject * t = PyDict_SetDefault (interned , s , s );
14613
14615
if (t == NULL ) {
You can’t perform that action at this time.
0 commit comments