mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Add function name to PyArg_ParseTuple()
This causes the supplied function name to appear in any error message, making the error message friendlier and relieving us from having to provide our own in some cases.
This commit is contained in:
parent
84d457edaf
commit
eaed88ce12
@ -406,7 +406,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args)
|
|||||||
volatile ResourceOwner oldowner;
|
volatile ResourceOwner oldowner;
|
||||||
Portal portal;
|
Portal portal;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "i", &count))
|
if (!PyArg_ParseTuple(args, "i:fetch", &count))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cursor = (PLyCursorObject *) self;
|
cursor = (PLyCursorObject *) self;
|
||||||
|
@ -114,12 +114,11 @@ PLy_plan_dealloc(PyObject *arg)
|
|||||||
static PyObject *
|
static PyObject *
|
||||||
PLy_plan_status(PyObject *self, PyObject *args)
|
PLy_plan_status(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if (PyArg_ParseTuple(args, ""))
|
if (PyArg_ParseTuple(args, ":status"))
|
||||||
{
|
{
|
||||||
Py_INCREF(Py_True);
|
Py_INCREF(Py_True);
|
||||||
return Py_True;
|
return Py_True;
|
||||||
/* return PyInt_FromLong(self->status); */
|
/* return PyInt_FromLong(self->status); */
|
||||||
}
|
}
|
||||||
PLy_exception_set(PLy_exc_error, "plan.status takes no arguments");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ PLy_quote_literal(PyObject *self, PyObject *args)
|
|||||||
char *quoted;
|
char *quoted;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s", &str))
|
if (!PyArg_ParseTuple(args, "s:quote_literal", &str))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
quoted = quote_literal_cstr(str);
|
quoted = quote_literal_cstr(str);
|
||||||
@ -340,7 +340,7 @@ PLy_quote_nullable(PyObject *self, PyObject *args)
|
|||||||
char *quoted;
|
char *quoted;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "z", &str))
|
if (!PyArg_ParseTuple(args, "z:quote_nullable", &str))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
@ -360,7 +360,7 @@ PLy_quote_ident(PyObject *self, PyObject *args)
|
|||||||
const char *quoted;
|
const char *quoted;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s", &str))
|
if (!PyArg_ParseTuple(args, "s:quote_ident", &str))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
quoted = quote_identifier(str);
|
quoted = quote_identifier(str);
|
||||||
|
@ -51,7 +51,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
|
|||||||
volatile ResourceOwner oldowner;
|
volatile ResourceOwner oldowner;
|
||||||
volatile int nargs;
|
volatile int nargs;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s|O", &query, &list))
|
if (!PyArg_ParseTuple(args, "s|O:prepare", &query, &list))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (list && (!PySequence_Check(list)))
|
if (list && (!PySequence_Check(list)))
|
||||||
|
Loading…
Reference in New Issue
Block a user