コード例 #1
0
ファイル: ElPeriodic.py プロジェクト: eckschi/libelperiodic
def _elpl_ptrcall_bare(cbobj):
    if pythonapi == None:
        # Happens when interpreter is being shut down
        return
    try:
        cbobj.handler(*cbobj.args)
    except Exception as e:
        pyo = py_object(cbobj)
        pythonapi.Py_DecRef(pyo)
        raise e
    pyo = py_object(cbobj)
    pythonapi.Py_DecRef(pyo)
コード例 #2
0
ファイル: ElPeriodic.py プロジェクト: eckschi/libelperiodic
 def call_from_thread(self, handler, *args):
     cbobj = _elpl_cb(handler, args)
     pyo = py_object(cbobj)
     pythonapi.Py_IncRef(pyo)
     rval = self._elpl.prdic_call_from_thread(self._hndl, \
       self._cbfunc, cbobj)
     if rval != 0:
         pythonapi.Py_DecRef(pyo)
         raise Exception('call_from_thread() = %d' % (rval, ))
コード例 #3
0
ファイル: ElPeriodic.py プロジェクト: eckschi/libelperiodic
def _elpl_ptrcall_safe(cbobj):
    #    print('_ptrcall(%s,%s,%s)' % (cbobj, cbobj.handler, cbobj.args))
    if pythonapi == None:
        # Happens when interpreter is being shut down
        return
    try:
        cbobj.handler(*cbobj.args)
    except Exception as e:
        sys.stderr.write('call_from_thread %s%s failed: %s\n' %
                         (cbobj.handler, cbobj.args, e))
        sys.stderr.flush()
    pyo = py_object(cbobj)
    pythonapi.Py_DecRef(pyo)
コード例 #4
0
 def __setitem__(self, idx, value):
     temp = list(self)
     try:
         temp[idx]
     except Exception as ex:
         raise patch_exc(ex)
     if isinstance(idx, int):
         pythonapi.Py_IncRef(py_object(value))
         ptr = py_object.from_address(id(self) + (3 + idx) * base_size)
         orig_obj, ptr.value = ptr.value, value
         pythonapi.Py_DecRef(py_object(orig_obj))
     else:
         temp[idx] = value
         replace_tuple(self, tuple(temp))
コード例 #5
0
ファイル: externalptr.py プロジェクト: yurivict/rapi
def finalizer(s):
    pythonapi.Py_DecRef(to_pyo(s))
コード例 #6
0
def on_collect_idris_obj(idris_arglist):
    py_obj = cast(
        cast(idris_arglist.contents.args[0],
             POINTER(Value_Pointer)).contents.p, py_object).value
    pythonapi.Py_DecRef(py_obj)