Skip to content

Commit eaed88c

Browse files
committed
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.
1 parent 84d457e commit eaed88c

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/pl/plpython/plpy_cursorobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args)
406406
volatile ResourceOwner oldowner;
407407
Portal portal;
408408

409-
if (!PyArg_ParseTuple(args, "i", &count))
409+
if (!PyArg_ParseTuple(args, "i:fetch", &count))
410410
return NULL;
411411

412412
cursor = (PLyCursorObject *) self;

src/pl/plpython/plpy_planobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,11 @@ PLy_plan_dealloc(PyObject *arg)
114114
static PyObject *
115115
PLy_plan_status(PyObject *self, PyObject *args)
116116
{
117-
if (PyArg_ParseTuple(args, ""))
117+
if (PyArg_ParseTuple(args, ":status"))
118118
{
119119
Py_INCREF(Py_True);
120120
return Py_True;
121121
/* return PyInt_FromLong(self->status); */
122122
}
123-
PLy_exception_set(PLy_exc_error, "plan.status takes no arguments");
124123
return NULL;
125124
}

src/pl/plpython/plpy_plpymodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ PLy_quote_literal(PyObject *self, PyObject *args)
323323
char *quoted;
324324
PyObject *ret;
325325

326-
if (!PyArg_ParseTuple(args, "s", &str))
326+
if (!PyArg_ParseTuple(args, "s:quote_literal", &str))
327327
return NULL;
328328

329329
quoted = quote_literal_cstr(str);
@@ -340,7 +340,7 @@ PLy_quote_nullable(PyObject *self, PyObject *args)
340340
char *quoted;
341341
PyObject *ret;
342342

343-
if (!PyArg_ParseTuple(args, "z", &str))
343+
if (!PyArg_ParseTuple(args, "z:quote_nullable", &str))
344344
return NULL;
345345

346346
if (str == NULL)
@@ -360,7 +360,7 @@ PLy_quote_ident(PyObject *self, PyObject *args)
360360
const char *quoted;
361361
PyObject *ret;
362362

363-
if (!PyArg_ParseTuple(args, "s", &str))
363+
if (!PyArg_ParseTuple(args, "s:quote_ident", &str))
364364
return NULL;
365365

366366
quoted = quote_identifier(str);

src/pl/plpython/plpy_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
5151
volatile ResourceOwner oldowner;
5252
volatile int nargs;
5353

54-
if (!PyArg_ParseTuple(args, "s|O", &query, &list))
54+
if (!PyArg_ParseTuple(args, "s|O:prepare", &query, &list))
5555
return NULL;
5656

5757
if (list && (!PySequence_Check(list)))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy