def put_decref_clear(self, cname, type, nanny=True): from PyrexTypes import py_object_type, typecast if nanny: self.putln("__Pyx_DECREF(%s); %s = 0;" % (typecast(py_object_type, type, cname), cname)) else: self.putln("Py_DECREF(%s); %s = 0;" % (typecast(py_object_type, type, cname), cname))
def put_init_to_py_none(self, cname, type, nanny=True): from PyrexTypes import py_object_type, typecast py_none = typecast(type, py_object_type, "Py_None") if nanny: self.putln("%s = %s; __Pyx_INCREF(Py_None);" % (cname, py_none)) else: self.putln("%s = %s; Py_INCREF(Py_None);" % (cname, py_none))
def as_pyobject(self, cname, type): from PyrexTypes import py_object_type, typecast return typecast(py_object_type, type, cname)
def put_init_to_py_none(self, cname, type): py_none = typecast(type, py_object_type, "Py_None") self.putln("%s = %s; Py_INCREF(Py_None);" % (cname, py_none))
def put_decref_clear(self, cname, type): self.putln("Py_DECREF(%s); %s = 0;" % ( typecast(py_object_type, type, cname), cname))
def as_pyobject(self, cname, type): return typecast(py_object_type, type, cname)
def put_decref_clear(self, cname, type): self.putln("Py_DECREF(%s); %s = 0;" % (typecast(py_object_type, type, cname), cname))
def as_pyobject(self, cname, type): if type: return typecast(py_object_type, type, cname) else: return cname