X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/dc0757504af5097a4bb323d64e429a99f86d1076..b4a8c46796f56693dd84744f8bfa4886c2d2be56:/field.c diff --git a/field.c b/field.c index cce2e89..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) @@ -958,7 +960,7 @@ static PyObject *meth__Field_parse(PyObject *me, PyObject *arg) qd.p = p; qd.e = 0; if ((f = field_parse(&qd)) == 0) - SYNERR(qd.e); + VALERR(qd.e); rc = Py_BuildValue("(Ns)", field_pywrap(f), qd.p); end: return (rc);