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

Function PLy_init_plpy

src/pl/plpython/plpy_plpymodule.c:144–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142#endif /* PY_MAJOR_VERSION >= 3 */
143
144void
145PLy_init_plpy(void)
146{
147 PyObject *main_mod,
148 *main_dict,
149 *plpy_mod;
150
151#if PY_MAJOR_VERSION < 3
152 PyObject *plpy;
153#endif
154
155 /*
156 * initialize plpy module
157 */
158 PLy_plan_init_type();
159 PLy_result_init_type();
160 PLy_subtransaction_init_type();
161 PLy_cursor_init_type();
162
163#if PY_MAJOR_VERSION >= 3
164 PyModule_Create(&PLy_module);
165 /* for Python 3 we initialized the exceptions in PyInit_plpy */
166#else
167 plpy = Py_InitModule("plpy", PLy_methods);
168 PLy_add_exceptions(plpy);
169#endif
170
171 /* PyDict_SetItemString(plpy, "PlanType", (PyObject *) &PLy_PlanType); */
172
173 /*
174 * initialize main module, and add plpy
175 */
176 main_mod = PyImport_AddModule("__main__");
177 main_dict = PyModule_GetDict(main_mod);
178 plpy_mod = PyImport_AddModule("plpy");
179 if (plpy_mod == NULL)
180 PLy_elog(ERROR, "could not import \"plpy\" module");
181 PyDict_SetItemString(main_dict, "plpy", plpy_mod);
182 if (PyErr_Occurred())
183 PLy_elog(ERROR, "could not import \"plpy\" module");
184}
185
186static void
187PLy_add_exceptions(PyObject *plpy)

Callers 1

PLy_initializeFunction · 0.85

Calls 5

PLy_plan_init_typeFunction · 0.85
PLy_result_init_typeFunction · 0.85
PLy_cursor_init_typeFunction · 0.85
PLy_add_exceptionsFunction · 0.85

Tested by

no test coverage detected