diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 53629b9df939dbddaec20f621d1a9c00faa5c354..c64d5577b8765cd096a52a164950f14589a9a439 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2599,7 +2599,7 @@ class TypecastNode(ExprNode): error(self.pos, "Casting temporary Python object to non-Python type") if to_py and not from_py: self.result_ctype = py_object_type - self.is_temp = 1 + self.is_temp = 1 def check_const(self): self.operand.check_const() @@ -2846,7 +2846,7 @@ class NumBinopNode(BinopNode): "/": "PyNumber_Divide", "//": "PyNumber_FloorDivide", "%": "PyNumber_Remainder", - "**": "PyNumber_Power" + "**": "PyNumber_Power" } diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index cff1b93c4c2031c36c633c0f88871cb9b8a2fcf6..7f9807cb5f45ba72055c6f82a5c39ada57981a5f 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2532,8 +2532,12 @@ class ForFromStatNode(StatNode): self.target.analyse_target_types(env) self.bound1.analyse_types(env) self.bound2.analyse_types(env) - self.bound1 = self.bound1.coerce_to(self.target.type, env) - self.bound2 = self.bound2.coerce_to(self.target.type, env) + if self.target.type.is_numeric: + self.bound1 = self.bound1.coerce_to(self.target.type, env) + self.bound2 = self.bound2.coerce_to(self.target.type, env) + else: + self.bound1 = self.bound1.coerce_to_integer(env) + self.bound2 = self.bound2.coerce_to_integer(env) if self.step is not None: if isinstance(self.step, ExprNodes.UnaryMinusNode): warning(self.step.pos, "Probable infinite loop in for-from-by statment. Consider switching the directions of the relations.", 2) @@ -2542,14 +2546,14 @@ class ForFromStatNode(StatNode): if not (self.bound2.is_name or self.bound2.is_literal): self.bound2 = self.bound2.coerce_to_temp(env) target_type = self.target.type - if not (target_type.is_pyobject or target_type.is_int): + if not (target_type.is_pyobject or target_type.is_numeric): error(self.target.pos, "Integer for-loop variable must be of type int or Python object") #if not (target_type.is_pyobject # or target_type.assignable_from(PyrexTypes.c_int_type)): # error(self.target.pos, # "Cannot assign integer to variable of type '%s'" % target_type) - if target_type.is_int: + if target_type.is_numeric: self.is_py_target = 0 self.loopvar_name = self.target.entry.cname self.py_loopvar_node = None diff --git a/Cython/Compiler/Version.py b/Cython/Compiler/Version.py index 5ae5a4970afdbafa5a0d23528836b9b72c57c353..3cc846323afdc604064de61465be923023a86e8d 100644 --- a/Cython/Compiler/Version.py +++ b/Cython/Compiler/Version.py @@ -1 +1 @@ -version = '0.9.6.10' +version = '0.9.6.10b' diff --git a/Cython/Mac/DarwinSystem.py b/Cython/Mac/DarwinSystem.py index 0b1a655c10772ca78dc3027b9d5b50ca37566eee..7b82467a996f298187678a8eb23a9f932700d577 100644 --- a/Cython/Mac/DarwinSystem.py +++ b/Cython/Mac/DarwinSystem.py @@ -18,7 +18,18 @@ py_include_dirs = [ "/Library/Frameworks/Python.framework/Versions/%s/Headers" % version_string ] -os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.3" +# MACOSX_DEPLOYMENT_TARGET can be set to 10.3 in most cases. +# But for the built-in Python 2.5.1 on Leopard, it needs to be set for 10.5. +# This looks like a bug that will be fixed in 2.5.2. If Apple updates their +# Python to 2.5.2, this fix should be OK. +import distutils.sysconfig as sc +python_prefix = sc.get_config_var('prefix') +leopard_python_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.5' +full_version = "%s.%s.%s" % sys.version_info[:3] +if python_prefix == leopard_python_prefix and full_version == '2.5.1': + os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.5" +else: + os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.3" compilers = ["gcc", "g++"] compiler_options = \