From 8fb4510e426b9635b47e97dfcddb0b174da12128 Mon Sep 17 00:00:00 2001 From: Catalin Iacob Date: Mon, 29 Feb 2016 07:29:37 +0100 Subject: [PATCH 4/5] Get rid of setting unused "position" We can then also remove the unused for anything else set_int_attr --- src/pl/plpython/plpy_elog.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index 7554840..a92c291 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/pl/plpython/plpy_elog.c @@ -33,7 +33,6 @@ static char *get_source_line(const char *src, int lineno); static void get_string_attr(PyObject *obj, char *attrname, char **str); static bool set_string_attr(PyObject *obj, char *attrname, char *str); -static bool set_int_attr(PyObject *obj, char *attrname, int iv); /* * Emit a PG error or notice, together with any available info about @@ -545,9 +544,6 @@ PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata) if (!set_string_attr(error, "query", edata->internalquery)) goto failure; - if (!set_int_attr(error, "position", edata->internalpos)) - goto failure; - if (!set_string_attr(error, "schema_name", edata->schema_name)) goto failure; @@ -616,19 +612,3 @@ set_string_attr(PyObject *obj, char *attrname, char *str) return result != -1; } -/* same as previous for int */ -static bool -set_int_attr(PyObject *obj, char *attrname, int iv) -{ - int result; - PyObject *val; - - val = PyInt_FromLong((long) iv); - if (!val) - return false; - - result = PyObject_SetAttrString(obj, attrname, val); - Py_DECREF(val); - - return result != -1; -} -- 2.7.1