From 3983bfa46748f5042c5f232050bc41dd91e0b5c9 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 23 Jan 2026 14:35:54 +0100 Subject: [PATCH] Don't crash on passing indeterminate to instance expecting aggregates #7529 --- src/ifcwrap/utils/type_conversion.i | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ifcwrap/utils/type_conversion.i b/src/ifcwrap/utils/type_conversion.i index 292a2e0c11..3eacf55fac 100644 --- a/src/ifcwrap/utils/type_conversion.i +++ b/src/ifcwrap/utils/type_conversion.i @@ -31,6 +31,7 @@ bool check_aggregate_of_type(PyObject* aggregate, void* type_obj) { if (!PySequence_Check(aggregate)) return false; + if (PySequence_Size(aggregate) == -1) return false; for(Py_ssize_t i = 0; i < PySequence_Size(aggregate); ++i) { PyObject* element = PySequence_GetItem(aggregate, i); // This is equivalent to the PyFloat_CheckExact macro. This means @@ -46,6 +47,7 @@ bool check_aggregate_of_aggregate_of_type(PyObject* aggregate, void* type_obj) { if (!PySequence_Check(aggregate)) return false; + if (PySequence_Size(aggregate) == -1) return false; for(Py_ssize_t i = 0; i < PySequence_Size(aggregate); ++i) { PyObject* element = PySequence_GetItem(aggregate, i); bool b = check_aggregate_of_type(element, type_obj);