From: Robert Bradshaw Date: Wed, 11 Feb 2009 21:11:50 +0000 (-0800) Subject: fix size_t conversions X-Git-Tag: 0.11.rc~83 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b95b578935490d1993160247224f6a50c4e7916a;p=cython.git fix size_t conversions --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 73525923..310bdb49 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1725,9 +1725,11 @@ class DefNode(FuncDefNode): (arg.type.is_extension_type or arg.type.is_builtin_type): arg.needs_type_test = 1 any_type_tests_needed = 1 - elif arg.type is PyrexTypes.c_py_ssize_t_type: - # Want to use __index__ rather than __int__ method - # that PyArg_ParseTupleAndKeywords calls + elif (arg.type is PyrexTypes.c_py_ssize_t_type + or arg.type is PyrexTypes.c_size_t_type): + # Don't use PyArg_ParseTupleAndKeywords's parsing + # Py_ssize_t: want to use __index__ rather than __int__ + # size_t: no Python format char arg.needs_conversion = 1 arg.hdr_type = PyrexTypes.py_object_type arg.hdr_cname = Naming.arg_prefix + arg.name diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 6022676b..0b1daceb 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1191,7 +1191,7 @@ c_slong_type = CIntType(3, 2, "T_LONG") c_slonglong_type = CLongLongType(4, 2, "T_LONGLONG") c_py_ssize_t_type = CPySSizeTType(5, 1) -c_size_t_type = CSizeTType(6, 1) +c_size_t_type = CSizeTType(6, 1, "(sizeof(size_t) == sizeof(unsigned long) ? T_ULONG : T_ULONGLONG)") c_float_type = CFloatType(7, "T_FLOAT") c_double_type = CFloatType(8, "T_DOUBLE")