From 894ef0a5b5ae3ee32cce9156d91795f6f7de7d6b Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 16 Nov 2024 15:54:52 +0800 Subject: [PATCH] Update py_list.c --- src/public/py_list.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/public/py_list.c b/src/public/py_list.c index f8489042..904653f1 100644 --- a/src/public/py_list.c +++ b/src/public/py_list.c @@ -244,9 +244,10 @@ static bool list__repr__(int argc, py_Ref argv) { static bool list_extend(int argc, py_Ref argv) { PY_CHECK_ARGC(2); List* self = py_touserdata(py_arg(0)); - PY_CHECK_ARG_TYPE(1, tp_list); - List* other = py_touserdata(py_arg(1)); - c11_vector__extend(py_TValue, self, other->data, other->length); + py_TValue* p; + int length = pk_arrayview(py_arg(1), &p); + if(length == -1) return TypeError("extend() argument must be a list or tuple"); + c11_vector__extend(py_TValue, self, p, length); py_newnone(py_retval()); return true; }