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

features = ["abi3", "num-bigint"] silently ignore "num-bigint" #3196

Closed
youknowone opened this issue Jun 1, 2023 · 2 comments · Fixed by #3198
Closed

features = ["abi3", "num-bigint"] silently ignore "num-bigint" #3196

youknowone opened this issue Jun 1, 2023 · 2 comments · Fixed by #3198
Labels

Comments

@youknowone
Copy link
Contributor

Bug Description

It happens because num_bigint.rs has #![cfg(all(feature = "num-bigint", not(any(Py_LIMITED_API))))] on the top, right?

If the features are actually not compatible, could there be any error or warning?

Steps to Reproduce

  1. Add num-bigint features and use the conversion features.
  2. Add abi3
  3. Then conversion code build fails.

Backtrace

No response

Your operating system and version

MacOS / 13.3.1

Your Python version (python --version)

Python 3.11.1

Your Rust version (rustc --version)

rustc 1.69.0 (84c898d65 2023-04-16)

Your PyO3 version

0.19.0

How did you install python? Did you use a virtualenv?

pyenv install 3.11.1 && pyenv virtualenv 3.11.1 pyo3 && pyenv local pyo3

Additional Info

Another suggestion is implementing num-bigint for Py_LIMITED_API. Since it is already using ffi::_PyLong_FromByteArray, using a python call through int.from_bytes and int.to_bytes will makes sense (with additional overhead).
I am sorry if this is a silly idea. Is this expected to be implemented on user side?

@davidhewitt
Copy link
Member

davidhewitt commented Jun 1, 2023

In #3185 we are in the process of fixing a different abi3 case where support for num-complex diverged. Similarly here I would happily accept a PR where we used a lower performance fallback to add support here. (Most likely using int.from_bytes and int.to_bytes as you propose.)

@youknowone
Copy link
Contributor Author

Thank you! I'll take a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants