From: Stefan Behnel Date: Fri, 14 Nov 2008 18:19:55 +0000 (+0100) Subject: array size must be set as int, not numeric string X-Git-Tag: 0.11-beta~255 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d48faaebb2d27b1a435d521b780ea058042a3620;p=cython.git array size must be set as int, not numeric string --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 99c455e7..56b69d8f 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -442,6 +442,11 @@ class CArrayDeclaratorNode(CDeclaratorNode): if not self.dimension.type.is_int: error(self.dimension.pos, "Array dimension not integer") size = self.dimension.result() + try: + size = int(size) + except ValueError: + # runtime constant? + pass else: size = None if not base_type.is_complete(): diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 70330959..281cf0ad 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -616,6 +616,7 @@ class CArrayType(CType): is_array = 1 def __init__(self, base_type, size): + assert size is None or isinstance(size, int), repr(size) self.base_type = base_type self.size = size if base_type is c_char_type: