MCPcopy Create free account
hub / github.com/apache/cloudberry / PLy_create_exception

Function PLy_create_exception

src/pl/plpython/plpy_plpymodule.c:226–250  ·  view source on GitHub ↗

* Create an exception object and add it to the module */

Source from the content-addressed store, hash-verified

224 * Create an exception object and add it to the module
225 */
226static PyObject *
227PLy_create_exception(char *name, PyObject *base, PyObject *dict,
228 const char *modname, PyObject *mod)
229{
230 PyObject *exc;
231
232 exc = PyErr_NewException(name, base, dict);
233 if (exc == NULL)
234 PLy_elog(ERROR, NULL);
235
236 /*
237 * PyModule_AddObject does not add a refcount to the object, for some odd
238 * reason; we must do that.
239 */
240 Py_INCREF(exc);
241 PyModule_AddObject(mod, modname, exc);
242
243 /*
244 * The caller will also store a pointer to the exception object in some
245 * permanent variable, so add another ref to account for that. This is
246 * probably excessively paranoid, but let's be sure.
247 */
248 Py_INCREF(exc);
249 return exc;
250}
251
252/*
253 * Add all the autogenerated exceptions as subclasses of SPIError

Callers 2

PLy_add_exceptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected