Changeset: f75d673d50d5 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f75d673d50d5 Modified Files: sql/backends/monet5/Tests/pyloader04.stable.err sql/backends/monet5/UDF/pyapi/emit.c Branch: default Log Message:
Fix segfault when using uninitialized variable and approve test for new pyloader behavior (attempt to cast element to string rather than requiring a string). diffs (41 lines): diff --git a/sql/backends/monet5/Tests/pyloader04.stable.err b/sql/backends/monet5/Tests/pyloader04.stable.err --- a/sql/backends/monet5/Tests/pyloader04.stable.err +++ b/sql/backends/monet5/Tests/pyloader04.stable.err @@ -39,11 +39,11 @@ ERROR = !Python exception MAPI = (monetdb) /var/tmp/mtest-6147/.s.monetdb.38930 QUERY = COPY LOADER INTO pyloader04table FROM pyloader04(); ERROR = !Python exception - !def pyfun(_emit,_conn): - ! _emit.emit({'a1': 3, 'a2': 4, 3: 5}) - ! - !Expected a string as dict key, but found <type 'int'> -MAPI = (monetdb) /var/tmp/mtest-6147/.s.monetdb.38930 + ! 1. def pyfun(_emit,_conn): + ! 2. _emit.emit({'a1': 3, 'a2': 4, 3: 5}) + !> 3. + !Unmatched element "3" in dict +MAPI = (monetdb) /var/tmp/mtest-79373/.s.monetdb.33370 QUERY = COPY LOADER INTO pyloader04table FROM pyloader04(); ERROR = !Python exception ! diff --git a/sql/backends/monet5/UDF/pyapi/emit.c b/sql/backends/monet5/UDF/pyapi/emit.c --- a/sql/backends/monet5/UDF/pyapi/emit.c +++ b/sql/backends/monet5/UDF/pyapi/emit.c @@ -86,7 +86,7 @@ static PyObject * PyObject *keys = PyDict_Keys(args); for(i = 0; i < (size_t) PyList_Size(keys); i++) { PyObject *key = PyList_GetItem(keys, i); - char *val; + char *val = NULL; bool found = false; msg = pyobject_to_str(&key, 42, &val); @@ -128,7 +128,7 @@ static PyObject * // create new columns based on the entries in the dictionary for(i = 0; i < (size_t) PyList_Size(keys); i++) { PyObject *key = PyList_GetItem(keys, i); - char *val; + char *val = NULL; bool found = false; msg = pyobject_to_str(&key, 42, &val); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list