diff --git a/psycopg/bytes_format.c b/psycopg/bytes_format.c index 991f7605..cd06b1cc 100644 --- a/psycopg/bytes_format.c +++ b/psycopg/bytes_format.c @@ -111,7 +111,7 @@ Bytes_Format(PyObject *format, PyObject *args) PyObject *result; PyObject *dict = NULL; if (format == NULL || !Bytes_Check(format) || args == NULL) { - PyErr_BadInternalCall(); + PyErr_SetString(PyExc_SystemError, "bad argument to internal function"); return NULL; } fmt = Bytes_AS_STRING(format);