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

Function PLy_function_restore_args

src/pl/plpython/plpy_exec.c:547–582  ·  view source on GitHub ↗

* Restore procedure's arguments from a PLySavedArgs struct, * then free the struct. */

Source from the content-addressed store, hash-verified

545 * then free the struct.
546 */
547static void
548PLy_function_restore_args(PLyProcedure *proc, PLySavedArgs *savedargs)
549{
550 /* Restore named arguments into their slots in the globals dict */
551 if (proc->argnames)
552 {
553 int i;
554
555 for (i = 0; i < savedargs->nargs; i++)
556 {
557 if (proc->argnames[i] && savedargs->namedargs[i])
558 {
559 PyDict_SetItemString(proc->globals, proc->argnames[i],
560 savedargs->namedargs[i]);
561 Py_DECREF(savedargs->namedargs[i]);
562 }
563 }
564 }
565
566 /* Restore the "args" object, too */
567 if (savedargs->args)
568 {
569 PyDict_SetItemString(proc->globals, "args", savedargs->args);
570 Py_DECREF(savedargs->args);
571 }
572
573 /* Restore the "TD" object, too */
574 if (savedargs->td)
575 {
576 PyDict_SetItemString(proc->globals, "TD", savedargs->td);
577 Py_DECREF(savedargs->td);
578 }
579
580 /* And free the PLySavedArgs struct */
581 pfree(savedargs);
582}
583
584/*
585 * Free a PLySavedArgs struct without restoring the values.

Callers 2

PLy_exec_functionFunction · 0.85
PLy_global_args_popFunction · 0.85

Calls 1

pfreeFunction · 0.50

Tested by

no test coverage detected