diff options
-rw-r--r-- | SWIG/_asn1.i | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/SWIG/_asn1.i b/SWIG/_asn1.i index a4c7e8e..b51b33f 100644 --- a/SWIG/_asn1.i +++ b/SWIG/_asn1.i @@ -148,10 +148,12 @@ int asn1_integer_set(ASN1_INTEGER *asn1, PyObject *value) { * PyLong_AsLong shims as provided in * /usr/include/python2.7/longobject.h. */ - int overflow = 0; - long val = PyLong_AsLongAndOverflow(value, &overflow); - if (overflow == 0) + long val = PyLong_AsLong(value); + if (val >= 0) { return ASN1_INTEGER_set(asn1, val); + } else { + PyErr_Clear(); + } if (!PyLong_Check(value)){ PyErr_SetString(PyExc_TypeError, "expected int or long"); |