Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
31f6b8f
Update listobject.c
chrstphrchvz Dec 4, 2023
0bfd8d4
Update listobject.c
chrstphrchvz Dec 4, 2023
3514d30
Update listobject.c
chrstphrchvz Dec 4, 2023
166c6c6
Update listobject.c
chrstphrchvz Dec 4, 2023
9675099
Update listobject.c
chrstphrchvz Dec 4, 2023
08423ce
Update listobject.c
chrstphrchvz Dec 4, 2023
e5c70b4
Update listobject.c
chrstphrchvz Dec 4, 2023
3f32102
Update listobject.c
chrstphrchvz Dec 5, 2023
136415b
Update listobject.c
chrstphrchvz Dec 5, 2023
7fc9eaf
Make list_subscript() compatible with PyCFunction and binaryfunc
chrstphrchvz Dec 6, 2023
5dbaa7e
Make listreviter_traverse() compatible with traverseproc
chrstphrchvz Dec 7, 2023
825867b
Make listreviter_dealloc() compatible with destructor
chrstphrchvz Dec 7, 2023
77927e5
Make listreviter_next() compatible with iternextfunc
chrstphrchvz Dec 7, 2023
6dd4236
Make listiter_traverse() compatible with traverseproc
chrstphrchvz Dec 7, 2023
8b6babf
Make listreviter_len() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
e20d180
Make listreviter_reduce() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
aceb958
Make listreviter_setstate() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
0532044
Make list_contains() compatible with objobjproc
chrstphrchvz Dec 7, 2023
7ef5480
Make list_inplace_concat() compatible with binaryfunc
chrstphrchvz Dec 7, 2023
6445fc6
Make list_ass_subscript() compatible with objobjargproc
chrstphrchvz Dec 7, 2023
fc9fccb
Make listiter_len() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
2dd6685
Make listiter_reduce() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
bf28e3e
Make listiter_setstate() compatible with PyCFunction
chrstphrchvz Dec 7, 2023
15f1bfc
Fix warning in list_subscript()
chrstphrchvz Dec 7, 2023
720c908
Make list_inplace_repeat() compatible with ssizeargfunc
chrstphrchvz Dec 7, 2023
d2bea5b
Slightly less inconsistent parameter names
chrstphrchvz Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update listobject.c
Objects/listobject.c:3229:5: warning: cast from 'void (*)(_PyListIterObject *)' to 'destructor' (aka 'void (*)(struct _object *)') converts to incompatible function type [-Wcast-function-type-strict]
 3229 |     (destructor)listiter_dealloc,               /* tp_dealloc */
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Example UBSan error:

Python/generated_cases.c.h:3322:21: runtime error: call to function listiter_dealloc through pointer to incorrect function type 'void (*)(struct _object *)'
listobject.c:3222: note: listiter_dealloc defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:3322:21 in
  • Loading branch information
chrstphrchvz committed Dec 7, 2023
commit 3f321023bbb71f517532159a9ffe01aa51a3d9f6
7 changes: 4 additions & 3 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,7 @@ PyTypeObject PyList_Type = {

/*********************** List Iterator **************************/

static void listiter_dealloc(_PyListIterObject *);
static void listiter_dealloc(PyObject *);
static int listiter_traverse(_PyListIterObject *, visitproc, void *);
static PyObject *listiter_next(PyObject *);
static PyObject *listiter_len(_PyListIterObject *, PyObject *);
Expand All @@ -3231,7 +3231,7 @@ PyTypeObject PyListIter_Type = {
sizeof(_PyListIterObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)listiter_dealloc, /* tp_dealloc */
listiter_dealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
Expand Down Expand Up @@ -3278,8 +3278,9 @@ list_iter(PyObject *seq)
}

static void
listiter_dealloc(_PyListIterObject *it)
listiter_dealloc(PyObject *obj)
{
_PyListIterObject *it = (_PyListIterObject *)obj;
_PyObject_GC_UNTRACK(it);
Py_XDECREF(it->it_seq);
PyObject_GC_Del(it);
Expand Down