Skip to content

Commit

Permalink
Merge pull request #608 from kngwyu/bigint
Browse files Browse the repository at this point in the history
Support conversion between num-bigint <-> Python Long
  • Loading branch information
kngwyu authored Oct 7, 2019
2 parents 36318fc + 9b2fbbb commit 091284d
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 51 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ libc = "0.2.62"
spin = "0.5.1"
num-traits = "0.2.8"
pyo3cls = { path = "pyo3cls", version = "=0.8.0" }
num-complex = { version = "0.2.3", optional = true }
num-complex = { version = ">= 0.2", optional = true }
num-bigint = { version = ">= 0.2", optional = true }
inventory = "0.1.4"
indoc = "0.3.4"
unindent = "0.1.4"
Expand Down
2 changes: 1 addition & 1 deletion ci/appveyor/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-Call
}
}

Invoke-Call { cargo test --verbose }
Invoke-Call { cargo test --verbose --features="num-bigint num-complex" }

$examplesDirectory = "examples"

Expand Down
2 changes: 1 addition & 1 deletion ci/travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -ex

# run `cargo test` only if testing against cpython.
if ! [[ $FEATURES == *"pypy"* ]]; then
cargo test --features "$FEATURES num-complex"
cargo test --features "$FEATURES num-bigint num-complex"
( cd pyo3-derive-backend; cargo test )
else
# check that pypy at least builds
Expand Down
2 changes: 2 additions & 0 deletions src/ffi/longobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ extern "C" {
#[cfg(not(Py_LIMITED_API))]
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub fn _PyLong_NumBits(obj: *mut PyObject) -> c_int;

#[cfg_attr(PyPy, link_name = "_PyPyLong_FromByteArray")]
pub fn _PyLong_FromByteArray(
bytes: *const c_uchar,
Expand Down
Loading

0 comments on commit 091284d

Please sign in to comment.