fixed python long to typedVar conversion

This commit is contained in:
ussrhero 2019-06-01 00:19:22 +03:00
parent 11e38853dc
commit ee03c669ae

View File

@ -51,7 +51,7 @@ public:
if (PyLong_Check(obj.ptr())) if (PyLong_Check(obj.ptr()))
{ {
if (_PyLong_Sign(obj.ptr()) >= 0) if (_PyLong_NumBits(obj.ptr()) > 63)
{ {
if (_PyLong_NumBits(obj.ptr()) > 64) if (_PyLong_NumBits(obj.ptr()) > 64)
throw pykd::OverflowException("int too big to convert"); throw pykd::OverflowException("int too big to convert");
@ -60,9 +60,6 @@ public:
} }
else else
{ {
if (_PyLong_NumBits(obj.ptr()) > 63)
throw pykd::OverflowException("int too big to convert");
var.setLongLong(PyLong_AsLongLong(obj.ptr())); var.setLongLong(PyLong_AsLongLong(obj.ptr()));
} }