Skip to content

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Oct 28, 2022

What does this implement/fix? Explain your changes.

BigInteger(byte[]) constructor uses the sign bit in the first byte.

Since we handle the sign separately, the fix is to prepend a zero byte to the number, which does not change it, but ensures sign bit is zero.

Does this close any currently open issues?

fixes #1990

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • Updated the CHANGELOG

BigInteger constructor uses the sign bit in the first byte. Since we explicitly handle the sign, the fix is to prepend a zero byte to the number, which does not change it, but ensures sign bit is zero.

fixes pythonnet#1990
@filmor filmor merged commit fb17907 into pythonnet:master Oct 28, 2022
@lostmsu lostmsu deleted the bugs/BadBigInt200 branch October 28, 2022 23:28
@lostmsu lostmsu mentioned this pull request Oct 29, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyInt.ToString returns wrong strings for values between 128 and 256
2 participants