Changeset: 40b17c5ccafe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/40b17c5ccafe
Modified Files:
monetdb5/mal/mal_exception.c
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.test
sql/backends/monet5/UDF/pyapi3/conversion3.c
Branch: Sep2022
Log Message:
Automatically add a newline to error messages for better concatenation.
diffs (54 lines):
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -91,7 +91,7 @@ createExceptionInternal(enum malexceptio
TRC_CRITICAL(MAL_SERVER, "called with bad arguments");
len = 0;
}
- msg = GDKmalloc(msglen + len + 1);
+ msg = GDKmalloc(msglen + len + 2);
if (msg != NULL) {
/* the calls below succeed: the arguments have already been
checked */
(void) strconcat_len(msg, msglen + 1,
@@ -99,7 +99,13 @@ createExceptionInternal(enum malexceptio
if (len > 0)
(void) vsnprintf(msg + msglen, len + 1, format, ap2);
va_end(ap2);
- char *q = msg;
+ char *q = msg + strlen(msg);
+ if (q[-1] != '\n') {
+ /* make sure message ends with newline, we already have
the space */
+ *q++ = '\n';
+ *q = '\0';
+ }
+ q = msg;
for (char *p = strchr(msg, '\n'); p; q = p + 1, p = strchr(q,
'\n'))
TRC_ERROR(MAL_SERVER, "%.*s\n", (int) (p - q), q);
if (*q)
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.test
b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.test
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.test
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.test
@@ -60,7 +60,7 @@ language P
return retval
}
-statement error PY000!Error converting dict return value "a": An array of size
2 was returned, yet we expect a list of 1 columns. The result is invalid..
+statement error PY000!Error converting dict return value "a": An array of size
2 was returned, yet we expect a list of 1 columns. The result is invalid.
SELECT * FROM pyapi17()
statement ok
diff --git a/sql/backends/monet5/UDF/pyapi3/conversion3.c
b/sql/backends/monet5/UDF/pyapi3/conversion3.c
--- a/sql/backends/monet5/UDF/pyapi3/conversion3.c
+++ b/sql/backends/monet5/UDF/pyapi3/conversion3.c
@@ -602,9 +602,9 @@ PyObject *PyDict_CheckForConversion(PyOb
if (object == NULL) {
msg = createException(
MAL, "pyapi3.eval",
- SQLSTATE(PY000) "Error converting dict return
value \"%s\": %s.",
+ SQLSTATE(PY000) "Error converting dict return
value \"%s\": %s",
retcol_names[i],
getExceptionMessage(*return_message));
- GDKfree(*return_message);
+ freeException(*return_message);
goto wrapup;
}
if (PyList_CheckExact(object)) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]