theLink 10.0
Loading...
Searching...
No Matches
MqCall_py.c File Reference

tag: nhi1-release-250425 More...

#include "LibMqMsgque_private_py.h"
#include "misc_check_py.h"
+ Include dependency graph for MqCall_py.c:

Go to the source code of this file.

Functions

enum MkErrorE pymqmsgque_ServiceCall (MQ_SERVICE_CALL_ARGS)
 
void pymqmsgque_ServiceFree (MK_RT mkrt, MQ_CTX const context, MK_PTR *dataP)
 
void pymqmsgque_ServiceCopy (MK_RT mkrt, MQ_CTX const context, MK_PTR *dataP)
 

Detailed Description

tag: nhi1-release-250425

Definition in file MqCall_py.c.

Function Documentation

◆ pymqmsgque_ServiceCall()

enum MkErrorE pymqmsgque_ServiceCall ( MQ_SERVICE_CALL_ARGS )

Definition at line 28 of file MqCall_py.c.

29{
31
32 PyObject * const callable = (PyObject*) __data__;
33 PyObject * selfarg = OT_SELF_X(mqctx);
34 PyObject * resultO = NULL;
35
36 // test if already deleted
37 if (VAL2CTX(selfarg) == NULL) {
38 return MkErrorSetC_2M(mqctx, "object is NULL");
39 } else if (Py_REFCNT(selfarg) == 0) {
40 return MK_OK;
41 }
42
43// PyThreadState* ts = PyThreadState_Swap(MK_RT_REF.mkThreadData.ptr);
44//printV("ts start: %p → %p", ts, MK_RT_REF.mkThreadData.ptr);
45
46 PyErr_Clear();
47
48 // for methods of the instance 'self' the argument 'self' is already set
49 if (PyMethod_Check(callable)) {
50 PyObject* mself = PyMethod_Self(callable);
51 if (mself == selfarg) {
52 selfarg = NULL;
53 }
54 }
55
56 // call the function
57 resultO = PyObject_CallFunctionObjArgs(callable, selfarg, NULL);
58
59 // no error return OK
60 if (resultO == NULL) goto error;
61
62 Py_CLEAR(resultO);
63 return MkErrorGetCodeI(&MkERROR); /* MkErrorGetCode_0E() */
64
65error:
67
68 return MkErrorStack_0E_Check();
69}
#define OT_SELF_X(x)
#define OT_ERROR_LNG_2_META(m)
#define VAL2CTX(val)
#define error
Definition high_lng.h:339
#define mqctx
#define MkErrorGetCodeI(e)
#define MkErrorStack_0E_Check()
#define MkErrorSetC_2M(err, message)
#define MkERROR
MK_OK
#define MQ_SERVICE_CALL_CHECK

◆ pymqmsgque_ServiceCopy()

void pymqmsgque_ServiceCopy ( MK_RT mkrt,
MQ_CTX const context,
MK_PTR * dataP )

Definition at line 82 of file MqCall_py.c.

87{
88 PyObject* self = (PyObject*)MkOBJ_R(context).self;
89
90//printSelf(self)
91
92 PyObject* callable = (PyObject*)(*dataP);
93 if (PyMethod_Check(callable)) {
94 //PyObject* oldself = PyMethod_Self(callable);
95//printSelf(oldself)
96 PyObject* const function = PyMethod_Function(callable);
97 if (function == NULL) {
98 MkPanicC_4M(context,__func__,-1,"unable to 'PyMethod_Function'");
99 } else {
100 callable = PyMethod_New(function, self);
101 if (callable == NULL) {
102 MkPanicC_4M(context,__func__,-1,"unable to 'PyMethod_New'");
103 } else {
104 *dataP = callable;
105 }
106 }
107 }
108 Py_INCREF(*dataP);
109}
#define MkPanicC_4M(errobj, callfunc, errnum, message)
#define MkOBJ_R(x)

◆ pymqmsgque_ServiceFree()

void pymqmsgque_ServiceFree ( MK_RT mkrt,
MQ_CTX const context,
MK_PTR * dataP )

Definition at line 72 of file MqCall_py.c.

77{
78 MK(CallFree)(dataP);
79}
#define MK(n)