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

Function PLy_init_interp

src/pl/plpython/plpy_main.c:199–217  ·  view source on GitHub ↗

* This should be called only once, from PLy_initialize. Initialize the Python * interpreter and global data. */

Source from the content-addressed store, hash-verified

197 * interpreter and global data.
198 */
199static void
200PLy_init_interp(void)
201{
202 static PyObject *PLy_interp_safe_globals = NULL;
203 PyObject *mainmod;
204
205 mainmod = PyImport_AddModule("__main__");
206 if (mainmod == NULL || PyErr_Occurred())
207 PLy_elog(ERROR, "could not import \"__main__\" module");
208 Py_INCREF(mainmod);
209 PLy_interp_globals = PyModule_GetDict(mainmod);
210 PLy_interp_safe_globals = PyDict_New();
211 if (PLy_interp_safe_globals == NULL)
212 PLy_elog(ERROR, NULL);
213 PyDict_SetItemString(PLy_interp_globals, "GD", PLy_interp_safe_globals);
214 Py_DECREF(mainmod);
215 if (PLy_interp_globals == NULL || PyErr_Occurred())
216 PLy_elog(ERROR, "could not initialize globals");
217}
218
219Datum
220plpython_validator(PG_FUNCTION_ARGS)

Callers 1

PLy_initializeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected