From 8f05d2e3cbf6b26907005228bdc20b98a053f4c5 Mon Sep 17 00:00:00 2001 From: Kyle Bloom Date: Sat, 12 Apr 2025 15:34:30 +0100 Subject: [PATCH] Add Iterators as acceptable arguments to functions --- src/api/python/z3/z3.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index 4a681c6cb..7e7d9a7b7 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -54,7 +54,7 @@ import io import math import copy if sys.version_info.major >= 3: - from typing import Iterable + from typing import Iterable, Iterator from collections.abc import Callable from typing import ( @@ -155,6 +155,8 @@ def _get_args(args): return args[0] elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)): return [arg for arg in args[0]] + elif len(args) == 1 and isinstance(args[0], Iterator): + return list(args[0]) else: return args except TypeError: # len is not necessarily defined when args is not a sequence (use reflection?)