Commit ae59c5a0 authored by Mark Florisson's avatar Mark Florisson

Fix compiler crash with type inferencing and add all() and any() to Utils

parent cbc3ddcf
......@@ -270,7 +270,7 @@ class SimpleAssignmentTypeInferer(object):
while ready_to_infer:
entry = ready_to_infer.pop()
types = [expr.infer_type(scope) for expr in entry.assignments]
if types:
if Utils.all(types):
entry.type = spanning_type(types, entry.might_overflow)
else:
# FIXME: raise a warning?
......
......@@ -19,6 +19,8 @@ from distutils.dir_util import mkpath
from distutils.command import build_ext as _build_ext
from distutils import sysconfig
from Cython.Utils import any
extension_name_re = _build_ext.extension_name_re
show_compilers = _build_ext.show_compilers
......@@ -55,16 +57,6 @@ class Optimization(object):
optimization = Optimization()
try:
any
except NameError:
def any(it):
for x in it:
if x:
return True
return False
class build_ext(_build_ext.build_ext):
......
......@@ -221,3 +221,21 @@ def none_or_sub(s, data):
else:
return s % data
# all() and any() are new in 2.5
try:
# Make sure to bind them on the module, as they will be accessed as
# attributes
all = all
any = any
except NameError:
def all(items):
for item in items:
if not item:
return False
return True
def any(items):
for item in items:
if item:
return True
return False
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment