diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2016-10-27 12:00:00 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2016-10-27 15:41:29 -0400 |
commit | eaed88ce120746b3004225252f52d8c79fea2f58 (patch) | |
tree | 2641cd6cc2ab19ff68e6f538a3ca764ea09b43de /src | |
parent | 84d457edaf4b3a1e10fd9e100e8ca18c042ad30c (diff) | |
download | postgresql-eaed88ce120746b3004225252f52d8c79fea2f58.tar.gz postgresql-eaed88ce120746b3004225252f52d8c79fea2f58.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/pl/plpython/plpy_cursorobject.c | 2 | ||||
-rw-r--r-- | src/pl/plpython/plpy_planobject.c | 3 | ||||
-rw-r--r-- | src/pl/plpython/plpy_plpymodule.c | 6 | ||||
-rw-r--r-- | src/pl/plpython/plpy_spi.c | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c index e682bfe566a..7bb89921484 100644 --- a/src/pl/plpython/plpy_cursorobject.c +++ b/src/pl/plpython/plpy_cursorobject.c @@ -406,7 +406,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args) volatile ResourceOwner oldowner; Portal portal; - if (!PyArg_ParseTuple(args, "i", &count)) + if (!PyArg_ParseTuple(args, "i:fetch", &count)) return NULL; cursor = (PLyCursorObject *) self; diff --git a/src/pl/plpython/plpy_planobject.c b/src/pl/plpython/plpy_planobject.c index a9040efb502..16c39a05ddf 100644 --- a/src/pl/plpython/plpy_planobject.c +++ b/src/pl/plpython/plpy_planobject.c @@ -114,12 +114,11 @@ PLy_plan_dealloc(PyObject *arg) static PyObject * PLy_plan_status(PyObject *self, PyObject *args) { - if (PyArg_ParseTuple(args, "")) + if (PyArg_ParseTuple(args, ":status")) { Py_INCREF(Py_True); return Py_True; /* return PyInt_FromLong(self->status); */ } - PLy_exception_set(PLy_exc_error, "plan.status takes no arguments"); return NULL; } diff --git a/src/pl/plpython/plpy_plpymodule.c b/src/pl/plpython/plpy_plpymodule.c index f520e7725f3..d80dc51b274 100644 --- a/src/pl/plpython/plpy_plpymodule.c +++ b/src/pl/plpython/plpy_plpymodule.c @@ -323,7 +323,7 @@ PLy_quote_literal(PyObject *self, PyObject *args) char *quoted; PyObject *ret; - if (!PyArg_ParseTuple(args, "s", &str)) + if (!PyArg_ParseTuple(args, "s:quote_literal", &str)) return NULL; quoted = quote_literal_cstr(str); @@ -340,7 +340,7 @@ PLy_quote_nullable(PyObject *self, PyObject *args) char *quoted; PyObject *ret; - if (!PyArg_ParseTuple(args, "z", &str)) + if (!PyArg_ParseTuple(args, "z:quote_nullable", &str)) return NULL; if (str == NULL) @@ -360,7 +360,7 @@ PLy_quote_ident(PyObject *self, PyObject *args) const char *quoted; PyObject *ret; - if (!PyArg_ParseTuple(args, "s", &str)) + if (!PyArg_ParseTuple(args, "s:quote_ident", &str)) return NULL; quoted = quote_identifier(str); diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c index 0d556a2ec28..b082d017ea9 100644 --- a/src/pl/plpython/plpy_spi.c +++ b/src/pl/plpython/plpy_spi.c @@ -51,7 +51,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args) volatile ResourceOwner oldowner; volatile int nargs; - if (!PyArg_ParseTuple(args, "s|O", &query, &list)) + if (!PyArg_ParseTuple(args, "s|O:prepare", &query, &list)) return NULL; if (list && (!PySequence_Check(list))) |