From 3d1dc84d531074bdc9591ac5554e9621f4c70bb8 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 24 Aug 2013 21:16:21 -0700 Subject: [PATCH] Conditionaly create int conversion functions. --- Cython/Compiler/PyrexTypes.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 07f4778..492ae56 100755 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1375,19 +1375,21 @@ class CIntType(CNumericType): exception_value = -1 def create_to_py_utility_code(self, env): - self.to_py_function = "__Pyx_PyInt_to_py_" + self.specialization_name() - env.use_utility_code(TempitaUtilityCode.load( - "CIntToPy", "TypeConversion.c", - context={"TYPE": self.declaration_code(''), - "TO_PY_FUNCTION": self.to_py_function})) + if type(self).to_py_function is None: + self.to_py_function = "__Pyx_PyInt_to_py_" + self.specialization_name() + env.use_utility_code(TempitaUtilityCode.load( + "CIntToPy", "TypeConversion.c", + context={"TYPE": self.declaration_code(''), + "TO_PY_FUNCTION": self.to_py_function})) return True def create_from_py_utility_code(self, env): - self.from_py_function = "__Pyx_PyInt_from_py_" + self.specialization_name() - env.use_utility_code(TempitaUtilityCode.load( - "CIntFromPy", "TypeConversion.c", - context={"TYPE": self.declaration_code(''), - "FROM_PY_FUNCTION": self.from_py_function})) + if type(self).from_py_function is None: + self.from_py_function = "__Pyx_PyInt_from_py_" + self.specialization_name() + env.use_utility_code(TempitaUtilityCode.load( + "CIntFromPy", "TypeConversion.c", + context={"TYPE": self.declaration_code(''), + "FROM_PY_FUNCTION": self.from_py_function})) return True def get_to_py_type_conversion(self): -- 2.7.4