Skip to content

Commit

Permalink
explicitly cast digits during PyLong conversion to avoid relying on p…
Browse files Browse the repository at this point in the history
…otentially unsafe C coercion (fixes ticket #865)
  • Loading branch information
scoder committed Sep 13, 2015
1 parent c7227ac commit 3489c22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cython/Utility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))


Expand Down

0 comments on commit 3489c22

Please sign in to comment.