Skip to content

Commit

Permalink
Python release 1.2.1 (#20)
Browse files Browse the repository at this point in the history
- add float() support for Python 3.7
- Travis-CI
-- fix Windows SSL error on new image
-- update Python to 3.8.6
  • Loading branch information
ixje authored Dec 7, 2020
1 parent 4a4a17c commit 9f6b8e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ jobs:
- os: windows
language: shell
before_install:
- choco install python --version 3.8.0
- choco install python --version 3.8.6
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
# Update root certificates to fix SSL error
- powershell "md C:\temp\certs; CertUtil -generateSSTFromWU C:\temp\certs\RootStore.sst; Get-ChildItem -Path C:\\temp\certs\Rootstore.sst | Import-Certificate -CertStoreLocation Cert:\\LocalMachine\\Root\\ | out-null"

env:
global:
Expand Down
5 changes: 3 additions & 2 deletions bindings/python/python-bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ py::int_ to_py_int(const BigInteger& value, bool is_signed = true, bool is_bigen
return py::reinterpret_steal<py::int_>(obj);
}

static constexpr auto VERSION_BINDINGS = "1.2";
static constexpr auto VERSION_BINDINGS = "1.2.1";

PYBIND11_MODULE(pybiginteger, m) {
m.doc() = "A C++ port of the C# BigInteger class";
Expand Down Expand Up @@ -306,7 +306,8 @@ PYBIND11_MODULE(pybiginteger, m) {
https://docs.microsoft.com/en-us/dotnet/api/system.numerics.biginteger.tobytearray?view=netcore-3.1#System_Numerics_BigInteger_ToByteArray_System_Boolean_System_Boolean_)",
py::arg("is_unsigned") = false,
py::arg("is_bigendian") = false)
.def("__int__", [](BigInteger& self) { return to_py_int(self); }) // support int()
.def("__int__", [](BigInteger& self) { return to_py_int(self); }) // support int()
.def("__float__", [](BigInteger& self) { return py::float_(to_py_int(self)); }) // support float() for Python < 3.8
.def("__index__", [](BigInteger& self) { return to_py_int(self); }) // support range()
.def("__str__", &BigInteger::to_string)
.def_static("zero", &BigInteger::zero)
Expand Down

0 comments on commit 9f6b8e9

Please sign in to comment.