3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 22:23:22 +00:00

Add Iterators as acceptable arguments to functions (#7620)

This commit is contained in:
Kyle Bloom 2025-04-12 18:32:56 +01:00 committed by GitHub
parent 6ecc7a2dd4
commit 5ad79f2864
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,7 @@ import io
import math import math
import copy import copy
if sys.version_info.major >= 3: if sys.version_info.major >= 3:
from typing import Iterable from typing import Iterable, Iterator
from collections.abc import Callable from collections.abc import Callable
from typing import ( from typing import (
@ -155,6 +155,8 @@ def _get_args(args):
return args[0] return args[0]
elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)): elif len(args) == 1 and (isinstance(args[0], set) or isinstance(args[0], AstVector)):
return [arg for arg in args[0]] return [arg for arg in args[0]]
elif len(args) == 1 and isinstance(args[0], Iterator):
return list(args[0])
else: else:
return args return args
except TypeError: # len is not necessarily defined when args is not a sequence (use reflection?) except TypeError: # len is not necessarily defined when args is not a sequence (use reflection?)