summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wozniak <dan@woz.io>2018-10-02 15:29:57 -0700
committerMatěj Cepl <mcepl@cepl.eu>2018-10-03 12:50:54 +0200
commit8e5ffdfafe88a6e7cb52232c80b931be0ce1e5b1 (patch)
treea9c62e449ecd4227c4fe837fd0bbc41d558b2740
parent1da650b1b858bba5d63446e9b3bb0abe811a53fb (diff)
downloadm2crypto-8e5ffdfafe88a6e7cb52232c80b931be0ce1e5b1.tar.gz
Handle set_serial overflow on python 2.6
-rw-r--r--SWIG/_asn1.i8
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");