The latter raises an exception if given an empty string, and reports
`bad radix' if it is, rather than `out of range'.
if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|i:fromstring",
kwlist, &me, &p, &len, &r))
goto end;
if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|i:fromstring",
kwlist, &me, &p, &len, &r))
goto end;
- if (!good_radix_p(r, 1)) VALERR("radix out of range");
+ if (!good_radix_p(r, 1)) VALERR("bad radix");
sc.buf = p; sc.lim = p + len;
sc.buf = p; sc.lim = p + len;
- if ((zz = mp_read(MP_NEW, r, &mptext_stringops, &sc)) == 0 || MP_NEGP(zz))
- z = Py_BuildValue("(Os#)", Py_None, p, len);
- else
- z = Py_BuildValue("(Ns#)", gf_pywrap(zz),
- sc.buf, (int)(sc.lim - sc.buf));
+ if ((zz = mp_read(MP_NEW, r, &mptext_stringops, &sc)) == 0 ||
+ MP_NEGP(zz)) {
+ if (zz) MP_DROP(zz);
+ SYNERR("bad binary polynomial");
+ }
+ z = Py_BuildValue("(Ns#)", gf_pywrap(zz), sc.buf, (int)(sc.lim - sc.buf));