diff --git a/src/api/python/z3/z3.py b/src/api/python/z3/z3.py index ee544bf44..2ad5814d3 100644 --- a/src/api/python/z3/z3.py +++ b/src/api/python/z3/z3.py @@ -50,7 +50,10 @@ import sys import io import math import copy -from typing import Iterable +if sys.version < '3': + pass +else: + from typing import Iterable Z3_DEBUG = __debug__ @@ -7513,7 +7516,7 @@ class Optimize(Z3PPObject): def asoft(a): v = Z3_optimize_assert_soft(self.ctx.ref(), self.optimize, a.as_ast(), weight, id) return OptimizeObjective(self, v, False) - if isinstance(arg, Iterable): + if sys.version >= '3' and isinstance(arg, Iterable): return [asoft(a) for a in arg] return asoft(arg)