@@ -103,16 +103,20 @@ PyObject _Py_EllipsisObject = _PyObject_HEAD_INIT(&PyEllipsis_Type);
103103
104104/* Slice object implementation */
105105
106-
107- void _PySlice_Fini (PyInterpreterState * interp )
106+ void _PySlice_ClearCache (_PyFreeListState * state )
108107{
109- PySliceObject * obj = interp -> slice_cache ;
108+ PySliceObject * obj = state -> slice_state . slice_cache ;
110109 if (obj != NULL ) {
111- interp -> slice_cache = NULL ;
110+ state -> slice_state . slice_cache = NULL ;
112111 PyObject_GC_Del (obj );
113112 }
114113}
115114
115+ void _PySlice_Fini (_PyFreeListState * state )
116+ {
117+ _PySlice_ClearCache (state );
118+ }
119+
116120/* start, stop, and step are python objects with None indicating no
117121 index is present.
118122*/
@@ -122,11 +126,11 @@ _PyBuildSlice_Consume2(PyObject *start, PyObject *stop, PyObject *step)
122126{
123127 assert (start != NULL && stop != NULL && step != NULL );
124128
125- PyInterpreterState * interp = _PyInterpreterState_GET ();
129+ _PyFreeListState * state = _PyFreeListState_GET ();
126130 PySliceObject * obj ;
127- if (interp -> slice_cache != NULL ) {
128- obj = interp -> slice_cache ;
129- interp -> slice_cache = NULL ;
131+ if (state -> slice_state . slice_cache != NULL ) {
132+ obj = state -> slice_state . slice_cache ;
133+ state -> slice_state . slice_cache = NULL ;
130134 _Py_NewReference ((PyObject * )obj );
131135 }
132136 else {
@@ -354,13 +358,13 @@ Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).");
354358static void
355359slice_dealloc (PySliceObject * r )
356360{
357- PyInterpreterState * interp = _PyInterpreterState_GET ();
361+ _PyFreeListState * state = _PyFreeListState_GET ();
358362 _PyObject_GC_UNTRACK (r );
359363 Py_DECREF (r -> step );
360364 Py_DECREF (r -> start );
361365 Py_DECREF (r -> stop );
362- if (interp -> slice_cache == NULL ) {
363- interp -> slice_cache = r ;
366+ if (state -> slice_state . slice_cache == NULL ) {
367+ state -> slice_state . slice_cache = r ;
364368 }
365369 else {
366370 PyObject_GC_Del (r );
0 commit comments