@@ -206,8 +206,7 @@ intern_constants(PyObject *tuple, int *modified)
206206{
207207 PyInterpreterState * interp = _PyInterpreterState_GET ();
208208#if !defined(Py_GIL_DISABLED )
209- PyObject * interned_dict = _Py_INTERP_CACHED_OBJECT (interp , interned_strings );
210- Py_INCREF (interned_dict );
209+ PyObject * interned_dict = get_interned_dict (interp );
211210#endif
212211 for (Py_ssize_t i = PyTuple_GET_SIZE (tuple ); -- i >= 0 ; ) {
213212 PyObject * v = PyTuple_GET_ITEM (tuple , i );
@@ -219,7 +218,7 @@ intern_constants(PyObject *tuple, int *modified)
219218 PyObject * interned = _Py_hashtable_get (INTERNED_STRINGS , v );
220219 if (interned == NULL ) {
221220 interned = PyDict_GetItemWithError (interned_dict , v );
222- if (PyErr_Occurred ()) goto error ;
221+ if (PyErr_Occurred ()) return -1 ;
223222 }
224223 if (interned != NULL && interned != v ) {
225224 Py_INCREF (interned );
@@ -239,25 +238,25 @@ intern_constants(PyObject *tuple, int *modified)
239238 }
240239 else if (PyTuple_CheckExact (v )) {
241240 if (intern_constants (v , NULL ) < 0 ) {
242- goto error ;
241+ return -1 ;
243242 }
244243 }
245244 else if (PyFrozenSet_CheckExact (v )) {
246245 PyObject * w = v ;
247246 PyObject * tmp = PySequence_Tuple (v );
248247 if (tmp == NULL ) {
249- goto error ;
248+ return -1 ;
250249 }
251250 int tmp_modified = 0 ;
252251 if (intern_constants (tmp , & tmp_modified ) < 0 ) {
253252 Py_DECREF (tmp );
254- goto error ;
253+ return -1 ;
255254 }
256255 if (tmp_modified ) {
257256 v = PyFrozenSet_New (tmp );
258257 if (v == NULL ) {
259258 Py_DECREF (tmp );
260- goto error ;
259+ return -1 ;
261260 }
262261
263262 PyTuple_SET_ITEM (tuple , i , v );
@@ -271,23 +270,23 @@ intern_constants(PyObject *tuple, int *modified)
271270 PySliceObject * slice = (PySliceObject * )v ;
272271 PyObject * tmp = PyTuple_New (3 );
273272 if (tmp == NULL ) {
274- goto error ;
273+ return -1 ;
275274 }
276275 PyTuple_SET_ITEM (tmp , 0 , Py_NewRef (slice -> start ));
277276 PyTuple_SET_ITEM (tmp , 1 , Py_NewRef (slice -> stop ));
278277 PyTuple_SET_ITEM (tmp , 2 , Py_NewRef (slice -> step ));
279278 int tmp_modified = 0 ;
280279 if (intern_constants (tmp , & tmp_modified ) < 0 ) {
281280 Py_DECREF (tmp );
282- goto error ;
281+ return -1 ;
283282 }
284283 if (tmp_modified ) {
285284 v = PySlice_New (PyTuple_GET_ITEM (tmp , 0 ),
286285 PyTuple_GET_ITEM (tmp , 1 ),
287286 PyTuple_GET_ITEM (tmp , 2 ));
288287 if (v == NULL ) {
289288 Py_DECREF (tmp );
290- goto error ;
289+ return -1 ;
291290 }
292291 PyTuple_SET_ITEM (tuple , i , v );
293292 Py_DECREF (slice );
@@ -304,7 +303,7 @@ intern_constants(PyObject *tuple, int *modified)
304303 {
305304 PyObject * interned = intern_one_constant (v );
306305 if (interned == NULL ) {
307- goto error ;
306+ return -1 ;
308307 }
309308 else if (interned != v ) {
310309 PyTuple_SET_ITEM (tuple , i , interned );
@@ -314,16 +313,7 @@ intern_constants(PyObject *tuple, int *modified)
314313 }
315314#endif
316315 }
317- #if !defined(Py_GIL_DISABLED )
318- Py_DECREF (interned_dict );
319- #endif
320316 return 0 ;
321-
322- error :
323- #if !defined(Py_GIL_DISABLED )
324- Py_DECREF (interned_dict );
325- #endif
326- return -1 ;
327317}
328318
329319/* Return a shallow copy of a tuple that is
0 commit comments