Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverflowError when converting python int to BigInt #629

Closed
programmerjake opened this issue Oct 15, 2019 · 0 comments · Fixed by #630
Closed

OverflowError when converting python int to BigInt #629

programmerjake opened this issue Oct 15, 2019 · 0 comments · Fixed by #630

Comments

@programmerjake
Copy link
Contributor

programmerjake commented Oct 15, 2019

Related: #622 #543 #608

I think what's happening is that the conversion code is not accounting for the converted bytes needing a sign bit so allocates too few bytes when converting numbers from i8_max to u8_max and all larger multiples of 8 bits

🌍 Environment

  • Your operating system and version:
    Ubuntu 18.04
  • Your python version:
    Python 3.6.8
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?:
    apt + virtualenv
  • Your rust version (rustc --version):
    rustc 1.40.0-nightly (e413dc36a 2019-10-14
  • Are you using the latest pyo3 version? Have you tried using latest master (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")?
    using commit c7f3cde

💥 Reproducing

https://github.com/programmerjake/pyo3_bigint_overflow/tree/7e03b67ef43976e01950811039cc78e1490973ad

Build:

maturin develop

Test:

python -m unittest
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 a pull request may close this issue.

1 participant