Commit 010ca805 authored by Stefan Behnel's avatar Stefan Behnel

assure constant declarations in bint->PyUnicode conversion code

parent 9fd9d301
...@@ -1768,7 +1768,7 @@ class CBIntType(CIntType): ...@@ -1768,7 +1768,7 @@ class CBIntType(CIntType):
return not format_spec return not format_spec
def to_pystring_function(self, code): def to_pystring_function(self, code):
if self.to_pyunicode_utility is None: # NOTE: no caching here as the string constant cnames depend on the current module
utility_code_name = "__Pyx_PyUnicode_FromBInt_" + self.specialization_name() utility_code_name = "__Pyx_PyUnicode_FromBInt_" + self.specialization_name()
to_pyunicode_utility = TempitaUtilityCode.load_cached( to_pyunicode_utility = TempitaUtilityCode.load_cached(
"CBIntToPyUnicode", "TypeConversion.c", context={ "CBIntToPyUnicode", "TypeConversion.c", context={
...@@ -1776,9 +1776,6 @@ class CBIntType(CIntType): ...@@ -1776,9 +1776,6 @@ class CBIntType(CIntType):
"FALSE_CONST": code.globalstate.get_py_string_const(StringEncoding.EncodedString("False")).cname, "FALSE_CONST": code.globalstate.get_py_string_const(StringEncoding.EncodedString("False")).cname,
"TO_PY_FUNCTION": utility_code_name, "TO_PY_FUNCTION": utility_code_name,
}) })
self.to_pyunicode_utility = (utility_code_name, to_pyunicode_utility)
else:
utility_code_name, to_pyunicode_utility = self.to_pyunicode_utility
code.globalstate.use_utility_code(to_pyunicode_utility) code.globalstate.use_utility_code(to_pyunicode_utility)
return utility_code_name return utility_code_name
......
...@@ -657,7 +657,7 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, char format_ch ...@@ -657,7 +657,7 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, char format_ch
/////////////// CBIntToPyUnicode.proto /////////////// /////////////// CBIntToPyUnicode.proto ///////////////
#define {{TO_PY_FUNCTION}}(value, format_char) \ #define {{TO_PY_FUNCTION}}(value, format_char) \
((value) ? (Py_INCREF({{TRUE_CONST}}), {{TRUE_CONST}}) : (Py_INCREF({{FALSE_CONST}}), {{FALSE_CONST}})) ((value) ? __Pyx_NewRef({{TRUE_CONST}}) : __Pyx_NewRef({{FALSE_CONST}}))
/////////////// PyIntFromDouble.proto /////////////// /////////////// PyIntFromDouble.proto ///////////////
......
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