File: | plpython.c |
Function: | PLy_output |
Error: | returning (PyObject*)NULL without setting an exception |
4220 static PyObject *
4221 PLy_output(volatile int level, PyObject *self, PyObject *args)
4222 {
4223 PyObject *volatile so;
4224 char *volatile sv;
4225 volatile MemoryContext oldcontext;
4226
4227 if (PyTuple_Size(args) == 1)
when PyTuple_Size() returns ob_size
when considering value == (Py_ssize_t)1 from plpython.c:4227
taking True path
4228 {
4229 /*
4230 * Treat single argument specially to avoid undesirable ('tuple',)
4231 * decoration.
4232 */
4233 PyObject *o;
4234
4235 PyArg_UnpackTuple(args, "plpy.elog", 1, 1, &o);
when PyArg_UnpackTuple() successfully unpacks 1 argument(s)
4236 so = PyObject_Str(o);
when PyObject_Str() succeeds
4237 }
4238 else
4239 so = PyObject_Str(args);
4240 if (so == NULL || ((sv = PyString_AsString(so)) == NULL))
taking False path
PyString_AsString() returns ob_sval
taking False path
4241 {
4242 level = ERROR;
4243 sv = dgettext(TEXTDOMAIN, "could not parse error message in plpy.elog");
4244 }
4245
4246 oldcontext = CurrentMemoryContext;
4247 PG_TRY();
when considering range: -0x80000000 <= value <= -1
taking False path
4248 {
4249 pg_verifymbstr(sv, strlen(sv), false);
4250 elog(level, "%s", sv);
4251 }
4252 PG_CATCH();
4253 {
4254 ErrorData *edata;
4255
4256 MemoryContextSwitchTo(oldcontext);
4257 edata = CopyErrorData();
4258 FlushErrorState();
4259
4260 /*
4261 * Note: If sv came from PyString_AsString(), it points into storage
4262 * owned by so. So free so after using sv.
4263 */
4264 Py_XDECREF(so);
taking False path
when taking True path
4265
4266 /* Make Python raise the exception */
4267 PLy_exception_set(PLy_exc_error, "%s", edata->message);
when treating unknown struct ErrorData * from plpython.c:4257 as non-NULL
4268 return NULL;
4269 }
4270 PG_END_TRY();
4271
4272 Py_XDECREF(so);
4273
4274 /*
4275 * return a legal object so the interpreter will continue on its merry way
4276 */
4277 Py_INCREF(Py_None);
4278 return Py_None;
4279 }
returning (PyObject*)NULL without setting an exception
found 4 similar trace(s) to this
File: | plpython.c |
Function: | PLy_output |
Error: | passing uninitialized data (o.278) as argument 1 to function at plpython.c:4236 |
4220 static PyObject *
4221 PLy_output(volatile int level, PyObject *self, PyObject *args)
4222 {
4223 PyObject *volatile so;
4224 char *volatile sv;
4225 volatile MemoryContext oldcontext;
4226
4227 if (PyTuple_Size(args) == 1)
when PyTuple_Size() returns ob_size
when considering value == (Py_ssize_t)1 from plpython.c:4227
taking True path
4228 {
4229 /*
4230 * Treat single argument specially to avoid undesirable ('tuple',)
4231 * decoration.
4232 */
4233 PyObject *o;
4234
4235 PyArg_UnpackTuple(args, "plpy.elog", 1, 1, &o);
when PyArg_UnpackTuple() fails
4236 so = PyObject_Str(o);
passing uninitialized data (o.278) as argument 1 to function at plpython.c:4236
4237 }
4238 else
4239 so = PyObject_Str(args);
4240 if (so == NULL || ((sv = PyString_AsString(so)) == NULL))
4241 {
4242 level = ERROR;
4243 sv = dgettext(TEXTDOMAIN, "could not parse error message in plpy.elog");
4244 }
4245
4246 oldcontext = CurrentMemoryContext;
4247 PG_TRY();
4248 {
4249 pg_verifymbstr(sv, strlen(sv), false);
4250 elog(level, "%s", sv);
4251 }
4252 PG_CATCH();
4253 {
4254 ErrorData *edata;
4255
4256 MemoryContextSwitchTo(oldcontext);
4257 edata = CopyErrorData();
4258 FlushErrorState();
4259
4260 /*
4261 * Note: If sv came from PyString_AsString(), it points into storage
4262 * owned by so. So free so after using sv.
4263 */
4264 Py_XDECREF(so);
4265
4266 /* Make Python raise the exception */
4267 PLy_exception_set(PLy_exc_error, "%s", edata->message);
4268 return NULL;
4269 }
4270 PG_END_TRY();
4271
4272 Py_XDECREF(so);
4273
4274 /*
4275 * return a legal object so the interpreter will continue on its merry way
4276 */
4277 Py_INCREF(Py_None);
4278 return Py_None;
4279 }