> > - assert(0); > > + PyErr_SetString(PyExc_ValueError, "invalid kind"); > > > > return NULL; > > > > } > > Is that really a ValueError? It should only be a ValueError if the user > could trigger that error. Otherwise it should be a SystemError.
You are right, ValueError is not best exception here. I used SystemError instead: see my commit 721bb2e59815. PyUnicode_FromFormat() does still use ValueError in PyUnicode_FromFormatV: PyErr_SetString(PyExc_ValueError, "incomplete format key"); PyErr_SetString(PyExc_ValueError, "width too big"); PyErr_SetString(PyExc_ValueError, "prec too big"); PyErr_SetString(PyExc_ValueError, "incomplete format"); PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " "at index %zd", (31<=c && c<=126) ? (char)c : '?', (int)c, fmtpos - 1); PyErr_Format(PyExc_ValueError, "PyUnicode_FromFormatV() expects an ASCII-encoded format " "string, got a non-ASCII byte: 0x%02x", (unsigned char)*f); Should we also replace them by SystemError? It might break backward compatibility, but I do really hope that nobody relies on these errors ;-) Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com