FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix positive `PyInt` converted to negative `BigInteger` by lostmsu · Pull Request #1993 · pythonnet/pythonnet · GitHub

Fix positive PyInt converted to negative BigInteger - #1993

Merged
filmor merged 1 commit into
pythonnet:masterfrom
losttech:bugs/BadBigInt200
Oct 28, 2022
Merged

Fix positive PyInt converted to negative BigInteger#1993
filmor merged 1 commit into
pythonnet:masterfrom
losttech:bugs/BadBigInt200

Conversation

lostmsu commented Oct 28, 2022
edited
Loading

Copy link
Copy Markdown
Member

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 merged commit fb17907 into pythonnet:master Oct 28, 2022
lostmsu deleted the bugs/BadBigInt200 branch October 28, 2022 23:28
lostmsu mentioned this pull request Oct 29, 2022
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL