* Restore procedure's arguments from a PLySavedArgs struct, * then free the struct. */
| 545 | * then free the struct. |
| 546 | */ |
| 547 | static void |
| 548 | PLy_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. |
no test coverage detected