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:
parent
6ecc7a2dd4
commit
5ad79f2864
1 changed files with 3 additions and 1 deletions
|
@ -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?)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue