X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/blobdiff_plain/80f7cd89bbb143dfa794e54be04994f55e851f7b..be6df1c38491ef517f2f55f2abc9c9e64ea034b0:/field.c diff --git a/field.c b/field.c index 2807c1c..0a5d908 100644 --- a/field.c +++ b/field.c @@ -263,10 +263,12 @@ end: static PyObject *fe_pyint(PyObject *x) { long l; + PyObject *rc; mp *xx = F_OUT(FE_F(x), MP_NEW, FE_X(x)); - if (mp_tolong_checked(xx, &l)) { MP_DROP(xx); return (0); } + if (!mp_tolong_checked(xx, &l, 0)) rc = PyInt_FromLong(l); + else rc = mp_topylong(xx); MP_DROP(xx); - return (PyInt_FromLong(l)); + return (rc); } static PyObject *fe_pylong(PyObject *x)