comparison python/pydc/pydc.c @ 65:75a4082f0fce

- refactoring of deprecated/removed func PyEval_CallObject()
author Tassilo Philipp
date Sun, 19 May 2024 15:45:13 +0200
parents 9b6cdffd30dd
children 7a61dd082341
comparison
equal deleted inserted replaced
64:6c494834e52a 65:75a4082f0fce
590 }; 590 };
591 591
592 /* generic callback handler dispatching to python */ 592 /* generic callback handler dispatching to python */
593 static char handle_py_callbacks(DCCallback* pcb, DCArgs* args, DCValue* result, void* userdata) 593 static char handle_py_callbacks(DCCallback* pcb, DCArgs* args, DCValue* result, void* userdata)
594 { 594 {
595
596 struct callback_userdata* x = (struct callback_userdata*)userdata; 595 struct callback_userdata* x = (struct callback_userdata*)userdata;
597 const char* sig_ptr = x->sig; 596 const char* sig_ptr = x->sig;
598 597
599 Py_ssize_t n_args = ((PyCodeObject*)PyFunction_GetCode(x->f))->co_argcount; 598 Py_ssize_t n_args = ((PyCodeObject*)PyFunction_GetCode(x->f))->co_argcount;
600 Py_ssize_t pos = 0; 599 Py_ssize_t pos = 0;
632 631
633 632
634 // we must be at end of sigstring, here 633 // we must be at end of sigstring, here
635 if(ch == ')') 634 if(ch == ')')
636 { 635 {
637 po = PyEval_CallObject(x->f, py_args); 636 po = PyObject_CallObject(x->f, py_args);
638 if(po) 637 if(po)
639 { 638 {
640 // return value type 639 // return value type
641 ch = *++sig_ptr; 640 ch = *++sig_ptr;
642 641