Skip to content

Commit 1f10eab

Browse files
fangererqunaibit
authored andcommitted
Use correct dealloc function for PySlice_Type
1 parent c7c5a98 commit 1f10eab

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

graalpython/com.oracle.graal.python.cext/src/sliceobject.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,23 +340,16 @@ PyDoc_STRVAR(slice_doc,
340340
slice(start, stop[, step])\n\
341341
\n\
342342
Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).");
343+
#endif // GraalPy change
343344

344345
static void
345346
slice_dealloc(PySliceObject *r)
346347
{
347-
PyInterpreterState *interp = _PyInterpreterState_GET();
348-
_PyObject_GC_UNTRACK(r);
349-
Py_DECREF(r->step);
350-
Py_DECREF(r->start);
351-
Py_DECREF(r->stop);
352-
if (interp->slice_cache == NULL) {
353-
interp->slice_cache = r;
354-
}
355-
else {
356-
PyObject_GC_Del(r);
357-
}
348+
// GraalPy change: different implementation
349+
GraalPyObject_GC_Del(r);
358350
}
359351

352+
#if 0 // GraalPy change
360353
static PyObject *
361354
slice_repr(PySliceObject *r)
362355
{
@@ -646,7 +639,7 @@ PyTypeObject PySlice_Type = {
646639
"slice", /* Name of this type */
647640
sizeof(PySliceObject), /* Basic object size */
648641
0, /* Item size for varobject */
649-
0, /* tp_dealloc */ // GraalPy change: nulled
642+
(destructor)slice_dealloc, /* tp_dealloc */
650643
0, /* tp_vectorcall_offset */
651644
0, /* tp_getattr */
652645
0, /* tp_setattr */

0 commit comments

Comments
 (0)