Commit 3489c221 authored by Stefan Behnel's avatar Stefan Behnel

explicitly cast digits during PyLong conversion to avoid relying on...

explicitly cast digits during PyLong conversion to avoid relying on potentially unsafe C coercion (fixes ticket #865)
parent c7227ac7
......@@ -6,8 +6,8 @@ def pylong_join(count, digits_ptr='digits', join_type='unsigned long'):
(((d[2] << n) | d[1]) << n) | d[0]
"""
return ('(' * (count * 2) + "(%s)" % join_type + ' | '.join(
"%s[%d])%s)" % (digits_ptr, _i, " << PyLong_SHIFT" if _i else '')
return ('(' * (count * 2) + ' | '.join(
"(%s)%s[%d])%s)" % (join_type, digits_ptr, _i, " << PyLong_SHIFT" if _i else '')
for _i in range(count-1, -1, -1)))
......
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