Add try-catch to all exposed functions
This commit is contained in:
parent
d77c3a61e1
commit
f17d4f7d62
2 changed files with 183 additions and 5 deletions
|
|
@ -63,6 +63,7 @@ typedef int Py_ssize_t;
|
|||
static PyObject *
|
||||
_wLLVMModuleCreateWithName(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char *s;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:LLVMModuleCreateWithName", &s)) {
|
||||
|
|
@ -71,6 +72,7 @@ _wLLVMModuleCreateWithName(PyObject *self, PyObject *args)
|
|||
|
||||
const LLVMModuleRef module = LLVMModuleCreateWithName(s);
|
||||
return ctor_LLVMModuleRef(module);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2str(LLVMGetDataLayout, LLVMModuleRef)
|
||||
|
|
@ -91,6 +93,7 @@ _wrap_objstrobj2obj(LLVMModuleGetOrInsertFunction, LLVMModuleRef,
|
|||
static PyObject *
|
||||
_wLLVMVerifyModule(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const LLVMModuleRef m = get_object_arg<LLVMModuleRef>(args) ;
|
||||
if (!m) return NULL;
|
||||
|
||||
|
|
@ -106,6 +109,7 @@ _wLLVMVerifyModule(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
///// unused
|
||||
|
|
@ -115,6 +119,7 @@ _wLLVMVerifyModule(PyObject *self, PyObject *args)
|
|||
static PyObject*
|
||||
_wLLVMGetModuleFromAssembly(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char * str;
|
||||
if ( !PyArg_ParseTuple(args, "s", &str) ){
|
||||
return NULL;
|
||||
|
|
@ -134,11 +139,13 @@ _wLLVMGetModuleFromAssembly(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ctor_LLVMModuleRef(mod);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGetModuleFromBitcode(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj ;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "S", &obj))
|
||||
|
|
@ -162,12 +169,13 @@ _wLLVMGetModuleFromBitcode(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ctor_LLVMModuleRef(m);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGetBitcodeFromModule(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
||||
_TRY
|
||||
const LLVMModuleRef m = get_object_arg<LLVMModuleRef>(args) ;
|
||||
if (!m ) return NULL;
|
||||
|
||||
|
|
@ -179,12 +187,13 @@ _wLLVMGetBitcodeFromModule(PyObject *self, PyObject *args)
|
|||
PyObject *ret = PyBytes_FromStringAndSize(chars, len);
|
||||
LLVMDisposeMessage(const_cast<char*>(chars));
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGetNativeCodeFromModule(PyObject * self, PyObject * args)
|
||||
{
|
||||
|
||||
_TRY
|
||||
PyObject * arg_m;
|
||||
int arg_use_asm;
|
||||
|
||||
|
|
@ -207,11 +216,13 @@ _wLLVMGetNativeCodeFromModule(PyObject * self, PyObject * args)
|
|||
LLVMDisposeMessage(const_cast<char*>(chars));
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMLinkModules(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
size_t mode = 0;
|
||||
|
||||
PyObject *dest_obj, *src_obj ;
|
||||
|
|
@ -235,6 +246,7 @@ _wLLVMLinkModules(PyObject *self, PyObject *args)
|
|||
|
||||
/* note: success => None, failure => string with error message */
|
||||
Py_RETURN_NONE;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
|
|
@ -310,7 +322,9 @@ obj2arr(PyObject *self, PyObject *args, arrcnt_fn_t cntfunc, obj2arr_fn_t arrfun
|
|||
static PyObject *
|
||||
_wLLVMGetFunctionTypeParams(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
return obj2arr(self, args, LLVMCountParamTypes, LLVMGetParamTypes);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/*===-- Struct types -----------------------------------------------------===*/
|
||||
|
|
@ -326,8 +340,10 @@ _wrap_objstr2none(LLVMSetStructName, LLVMTypeRef)
|
|||
static PyObject *
|
||||
_wLLVMGetStructElementTypes(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
return obj2arr(self, args, LLVMCountStructElementTypes,
|
||||
LLVMGetStructElementTypes);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -382,6 +398,7 @@ _wrap_obj2obj(LLVMValueGetNumUses, LLVMValueRef, int)
|
|||
static PyObject *
|
||||
_wLLVMValueGetUses(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const LLVMValueRef value = get_object_arg<LLVMValueRef>(args) ;
|
||||
if (!value) return NULL;
|
||||
|
||||
|
|
@ -393,6 +410,7 @@ _wLLVMValueGetUses(PyObject *self, PyObject *args)
|
|||
LLVMDisposeValueRefArray(uses);
|
||||
|
||||
return list;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/*===-- Users ------------------------------------------------------------===*/
|
||||
|
|
@ -416,6 +434,7 @@ _wrap_obj2obj(LLVMIsUndef, LLVMValueRef, int)
|
|||
static PyObject *
|
||||
_wLLVMConstInt(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj;
|
||||
unsigned long long n;
|
||||
int sign_extend;
|
||||
|
|
@ -428,11 +447,13 @@ _wLLVMConstInt(PyObject *self, PyObject *args)
|
|||
const LLVMValueRef val = LLVMConstInt(ty, n, sign_extend);
|
||||
|
||||
return ctor_LLVMValueRef(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMConstReal(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj;
|
||||
double d;
|
||||
|
||||
|
|
@ -443,6 +464,7 @@ _wLLVMConstReal(PyObject *self, PyObject *args)
|
|||
|
||||
const LLVMValueRef val = LLVMConstReal(ty, d);
|
||||
return ctor_LLVMValueRef(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_objstr2obj(LLVMConstRealOfString, LLVMTypeRef, LLVMValueRef)
|
||||
|
|
@ -454,6 +476,7 @@ _wrap_obj2obj(LLVMConstIntGetSExtValue, LLVMValueRef, llvmwrap_ll)
|
|||
static PyObject *
|
||||
_wLLVMConstString(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char *s;
|
||||
int dont_null_terminate;
|
||||
|
||||
|
|
@ -463,6 +486,7 @@ _wLLVMConstString(PyObject *self, PyObject *args)
|
|||
|
||||
LLVMValueRef val = LLVMConstString(s, strlen(s), dont_null_terminate);
|
||||
return ctor_LLVMValueRef(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_objlist2obj(LLVMConstArray, LLVMTypeRef, LLVMValueRef, LLVMValueRef)
|
||||
|
|
@ -574,10 +598,12 @@ _wrap_objenum2none(LLVMRemoveFunctionAttr, LLVMValueRef, LLVMAttribute)
|
|||
static PyObject *
|
||||
_wLLVMVerifyFunction(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const LLVMValueRef fn = get_object_arg<LLVMValueRef>(args);
|
||||
if (!fn) return NULL;
|
||||
|
||||
return ctor_int(LLVMVerifyFunction(fn, LLVMReturnStatusAction));
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -615,6 +641,7 @@ _wrap_objstr2obj(LLVMMetaDataStringGet, LLVMModuleRef, LLVMValueRef)
|
|||
static PyObject *
|
||||
_wLLVMGetNamedMetadataOperands(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj_module;
|
||||
const char *name;
|
||||
|
||||
|
|
@ -630,6 +657,7 @@ _wLLVMGetNamedMetadataOperands(PyObject *self, PyObject *args)
|
|||
free(operands);
|
||||
|
||||
return list;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/*===-- Instructions -----------------------------------------------------===*/
|
||||
|
|
@ -699,6 +727,7 @@ _wrap_objobjobjint2obj(LLVMBuildSwitch, LLVMBuilderRef, LLVMValueRef, LLVMBasicB
|
|||
static PyObject *
|
||||
_wLLVMBuildInvoke(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1, *obj2, *obj3, *obj4, *obj5;
|
||||
const char *name;
|
||||
|
||||
|
|
@ -725,6 +754,7 @@ _wLLVMBuildInvoke(PyObject *self, PyObject *args)
|
|||
delete [] fnargs;
|
||||
|
||||
return ctor_LLVMValueRef(inst);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2obj(LLVMBuildUnreachable, LLVMBuilderRef, LLVMValueRef)
|
||||
|
|
@ -818,6 +848,7 @@ _wrap_objobjobjobjstr2obj(LLVMBuildShuffleVector, LLVMBuilderRef, LLVMValueRef,
|
|||
static PyObject *
|
||||
_wLLVMCreateMemoryBufferWithContentsOfFile(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char *path;
|
||||
LLVMMemoryBufferRef ref;
|
||||
PyObject *ret;
|
||||
|
|
@ -835,11 +866,13 @@ _wLLVMCreateMemoryBufferWithContentsOfFile(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMCreateMemoryBufferWithSTDIN(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *ret;
|
||||
LLVMMemoryBufferRef ref;
|
||||
char *outmsg;
|
||||
|
|
@ -851,6 +884,7 @@ _wLLVMCreateMemoryBufferWithSTDIN(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2none(LLVMDisposeMemoryBuffer, LLVMMemoryBufferRef)
|
||||
|
|
@ -1041,6 +1075,7 @@ _wrap_obj2none(LLVMDisposeTargetMachine, LLVMTargetMachineRef)
|
|||
static PyObject *
|
||||
_wLLVMTargetMachineLookup(PyObject * self, PyObject * args)
|
||||
{
|
||||
_TRY
|
||||
const char *arch;
|
||||
const char *cpu;
|
||||
const char *features;
|
||||
|
|
@ -1057,12 +1092,13 @@ _wLLVMTargetMachineLookup(PyObject * self, PyObject * args)
|
|||
return NULL;
|
||||
}
|
||||
return ctor_LLVMTargetMachineRef(tm);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMTargetMachineEmitFile(PyObject * self, PyObject * args)
|
||||
{
|
||||
|
||||
_TRY
|
||||
PyObject *arg_tm, *arg_m;
|
||||
int arg_use_asm;
|
||||
|
||||
|
|
@ -1086,6 +1122,7 @@ _wLLVMTargetMachineEmitFile(PyObject * self, PyObject * args)
|
|||
PyObject * ret = PyBytes_FromStringAndSize(chars, len);
|
||||
delete [] ubytes;
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2obj(LLVMTargetMachineGetTargetData, LLVMTargetMachineRef,
|
||||
|
|
@ -1108,6 +1145,7 @@ _wrap_obj2none(LLVMDisposeTargetData, LLVMTargetDataRef)
|
|||
static PyObject *
|
||||
_wLLVMTargetDataAsString(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const LLVMTargetDataRef td = get_object_arg<LLVMTargetDataRef>(args);
|
||||
if (!td) return NULL;
|
||||
|
||||
|
|
@ -1115,6 +1153,7 @@ _wLLVMTargetDataAsString(PyObject *self, PyObject *args)
|
|||
PyObject *ret = PyUnicode_FromString(tdrep);
|
||||
LLVMDisposeMessage(tdrep);
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_objobj2none(LLVMAddTargetData, LLVMTargetDataRef, LLVMPassManagerRef)
|
||||
|
|
@ -1155,6 +1194,7 @@ _wrap_objstr2none(LLVMEngineBuilderSetMAttrs, LLVMEngineBuilderRef)
|
|||
static PyObject *
|
||||
_wLLVMEngineBuilderCreate(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const LLVMEngineBuilderRef obj
|
||||
= get_object_arg<LLVMEngineBuilderRef>(args) ;
|
||||
if (!obj)
|
||||
|
|
@ -1171,6 +1211,7 @@ _wLLVMEngineBuilderCreate(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
|
|
@ -1180,6 +1221,7 @@ _wLLVMEngineBuilderCreate(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
_wLLVMCreateExecutionEngine(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj;
|
||||
int force_interpreter;
|
||||
char *outmsg = 0;
|
||||
|
|
@ -1205,11 +1247,13 @@ _wLLVMCreateExecutionEngine(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGetPointerToFunction(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj_ee;
|
||||
PyObject *obj_fn;
|
||||
|
||||
|
|
@ -1220,6 +1264,7 @@ _wLLVMGetPointerToFunction(PyObject *self, PyObject *args)
|
|||
const LLVMValueRef fn = pycap_get<LLVMValueRef>( obj_fn ) ;
|
||||
|
||||
return PyLong_FromVoidPtr(LLVMGetPointerToFunction(ee,fn));
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
/* the args should have been ptr, num */
|
||||
|
|
@ -1232,8 +1277,8 @@ LLVMGenericValueRef LLVMRunFunction2(LLVMExecutionEngineRef EE,
|
|||
static PyObject *
|
||||
_wLLVMRemoveModule2(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj_ee;
|
||||
|
||||
PyObject *obj_mod;
|
||||
if (!PyArg_ParseTuple(args, "OO", &obj_ee, &obj_mod))
|
||||
return NULL;
|
||||
|
|
@ -1257,6 +1302,7 @@ _wLLVMRemoveModule2(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
return ret;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2none(LLVMDisposeExecutionEngine, LLVMExecutionEngineRef)
|
||||
|
|
@ -1279,6 +1325,7 @@ _wrap_objobj2none(LLVMAddModule, LLVMExecutionEngineRef,
|
|||
static PyObject *
|
||||
_wLLVMCreateGenericValueOfInt(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1;
|
||||
unsigned long long n;
|
||||
int is_signed;
|
||||
|
|
@ -1291,11 +1338,13 @@ _wLLVMCreateGenericValueOfInt(PyObject *self, PyObject *args)
|
|||
|
||||
gv = LLVMCreateGenericValueOfInt(ty, n, is_signed);
|
||||
return ctor_LLVMGenericValueRef(gv);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMCreateGenericValueOfFloat(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1;
|
||||
double d;
|
||||
LLVMGenericValueRef gv;
|
||||
|
|
@ -1307,11 +1356,13 @@ _wLLVMCreateGenericValueOfFloat(PyObject *self, PyObject *args)
|
|||
|
||||
gv = LLVMCreateGenericValueOfFloat(ty, d);
|
||||
return ctor_LLVMGenericValueRef(gv);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMCreateGenericValueOfPointer(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
// PyObject *obj1;
|
||||
// LLVMTypeRef ty; //unused?
|
||||
unsigned long long n_;
|
||||
|
|
@ -1324,11 +1375,13 @@ _wLLVMCreateGenericValueOfPointer(PyObject *self, PyObject *args)
|
|||
|
||||
const LLVMGenericValueRef gv = LLVMCreateGenericValueOfPointer((void*)n);
|
||||
return ctor_LLVMGenericValueRef(gv);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGenericValueToInt(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1;
|
||||
int is_signed;
|
||||
unsigned long long val;
|
||||
|
|
@ -1342,11 +1395,13 @@ _wLLVMGenericValueToInt(PyObject *self, PyObject *args)
|
|||
return is_signed ?
|
||||
PyLong_FromLongLong((long long)val) :
|
||||
PyLong_FromUnsignedLongLong(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGenericValueToFloat(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1, *obj2;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO", &obj1, &obj2))
|
||||
|
|
@ -1357,11 +1412,13 @@ _wLLVMGenericValueToFloat(PyObject *self, PyObject *args)
|
|||
|
||||
double val = LLVMGenericValueToFloat(ty, gv);
|
||||
return PyFloat_FromDouble(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMGenericValueToPointer(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
PyObject *obj1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &obj1))
|
||||
|
|
@ -1371,6 +1428,7 @@ _wLLVMGenericValueToPointer(PyObject *self, PyObject *args)
|
|||
|
||||
void * val = LLVMGenericValueToPointer(gv);
|
||||
return PyLong_FromVoidPtr(val);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2none(LLVMDisposeGenericValue, LLVMGenericValueRef)
|
||||
|
|
@ -1386,6 +1444,7 @@ _wrap_objintlist2obj(LLVMGetIntrinsic, LLVMModuleRef, LLVMTypeRef,
|
|||
static PyObject *
|
||||
_wLLVMLoadLibraryPermanently(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char *filename;
|
||||
PyObject *ret;
|
||||
|
||||
|
|
@ -1404,11 +1463,13 @@ _wLLVMLoadLibraryPermanently(PyObject *self, PyObject *args)
|
|||
|
||||
/* note: success => None, failure => string with error message */
|
||||
Py_RETURN_NONE;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wLLVMParseEnvOpts(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
const char * progname;
|
||||
const char * envname;
|
||||
if(!PyArg_ParseTuple(args, "ss", &progname, &envname)) {
|
||||
|
|
@ -1418,6 +1479,7 @@ _wLLVMParseEnvOpts(PyObject *self, PyObject *args)
|
|||
llvm::cl::ParseEnvironmentOptions(progname, envname);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
_wrap_obj2obj(LLVMInlineFunction, LLVMValueRef, int)
|
||||
|
|
@ -1427,12 +1489,14 @@ _wrap_obj2obj(LLVMInlineFunction, LLVMValueRef, int)
|
|||
static PyObject *
|
||||
_wPyCObjectVoidPtrToPyLong(PyObject *self, PyObject *args)
|
||||
{
|
||||
_TRY
|
||||
void *p;
|
||||
|
||||
if (!(p = get_object_arg(args)))
|
||||
return NULL;
|
||||
|
||||
return PyLong_FromVoidPtr(p);
|
||||
_CATCH_ALL
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
116
llvm/wrap.h
116
llvm/wrap.h
|
|
@ -59,7 +59,23 @@
|
|||
|
||||
#include "llvm_c_extra.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
#define _CHECK_PYCAP(X) if( !(X) ) return NULL;
|
||||
#define _TRY \
|
||||
try {
|
||||
|
||||
#define _CATCH_ALL \
|
||||
} catch (const std::bad_alloc&) { \
|
||||
return PyErr_NoMemory(); \
|
||||
} catch (const std::exception& e) { \
|
||||
PyErr_SetString(PyExc_RuntimeError, e.what()); \
|
||||
return NULL; \
|
||||
} catch (...) { \
|
||||
PyErr_SetString(PyExc_RuntimeError, \
|
||||
"Unknown exception"); \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* Typedefs */
|
||||
|
|
@ -176,10 +192,12 @@ LLTYPE make_array_from_list(PyObject *list, int n)
|
|||
static PyObject * \
|
||||
_w ## func(PyObject * self, PyObject * args) \
|
||||
{ \
|
||||
_TRY \
|
||||
if (!PyArg_ParseTuple(args, "")) \
|
||||
return NULL; \
|
||||
func(); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -190,12 +208,14 @@ _w ## func(PyObject * self, PyObject * args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype1 arg1; \
|
||||
\
|
||||
if (!(arg1 = get_object_arg<intype1>(args))) \
|
||||
return NULL; \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -206,12 +226,14 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
int arg1; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "i", &arg1)) \
|
||||
return NULL; \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -222,6 +244,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OO", &obj1, &obj2)) \
|
||||
|
|
@ -234,6 +257,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
if ( !arg1 || !arg2 ) return NULL; \
|
||||
return ctor_ ## outtype ( func (arg1, arg2)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -244,6 +268,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OO", &obj1, &obj2)) \
|
||||
|
|
@ -256,6 +281,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -266,6 +292,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
size_t arg2; \
|
||||
\
|
||||
|
|
@ -276,6 +303,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg1); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,6 +314,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OOO", &obj1, &obj2, &obj3)) \
|
||||
|
|
@ -299,6 +328,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -309,6 +339,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OOO", &obj1, &obj2, &obj3)) \
|
||||
|
|
@ -323,6 +354,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2, arg3); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -333,6 +365,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
size_t arg1; \
|
||||
PyObject *obj2, *obj3; \
|
||||
\
|
||||
|
|
@ -345,6 +378,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -355,6 +389,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype1 arg1; \
|
||||
PyObject *obj2, *obj3; \
|
||||
\
|
||||
|
|
@ -367,6 +402,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -377,12 +413,14 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
const char *arg1; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "s", &arg1)) \
|
||||
return NULL; \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -393,10 +431,12 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
if (!PyArg_ParseTuple(args, "")) \
|
||||
return NULL; \
|
||||
\
|
||||
return ctor_ ## outtype ( func ()); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -408,9 +448,11 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
if (!PyArg_ParseTuple(args, "")) \
|
||||
return NULL; \
|
||||
return PyUnicode_FromString(func()); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -422,12 +464,14 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype1 arg1; \
|
||||
\
|
||||
if (!(arg1 = get_object_arg<intype1>(args))) \
|
||||
return NULL; \
|
||||
\
|
||||
return PyUnicode_FromString( func (arg1)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -438,6 +482,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype1 arg1; \
|
||||
\
|
||||
if (!(arg1 = get_object_arg<intype1>(args))) \
|
||||
|
|
@ -445,6 +490,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -455,6 +501,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
const char *arg2; \
|
||||
\
|
||||
|
|
@ -466,6 +513,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -476,6 +524,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
const char *arg2; \
|
||||
\
|
||||
|
|
@ -486,6 +535,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg1); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -496,6 +546,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
int arg2; \
|
||||
\
|
||||
|
|
@ -507,6 +558,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -517,6 +569,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype2 arg2; \
|
||||
PyObject *obj1; \
|
||||
\
|
||||
|
|
@ -528,6 +581,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -538,6 +592,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
const char *arg3; \
|
||||
\
|
||||
|
|
@ -550,6 +605,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -560,6 +616,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
int arg3; \
|
||||
\
|
||||
|
|
@ -572,6 +629,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)) ; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -582,6 +640,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
unsigned long long arg3; \
|
||||
\
|
||||
|
|
@ -594,6 +653,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)) ; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -604,6 +664,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
int arg2, arg3; \
|
||||
\
|
||||
|
|
@ -615,6 +676,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2, arg3); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -625,6 +687,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
int arg2; \
|
||||
intype3 arg3; \
|
||||
|
|
@ -636,6 +699,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
\
|
||||
func (arg1, arg2, arg3); \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -646,6 +710,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj3; \
|
||||
const char *arg2; \
|
||||
\
|
||||
|
|
@ -658,6 +723,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -668,6 +734,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj3; \
|
||||
const char *arg2; \
|
||||
\
|
||||
|
|
@ -682,6 +749,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
func(arg1, arg2, arg3); \
|
||||
\
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -693,6 +761,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
int arg3; \
|
||||
const char *arg4; \
|
||||
|
|
@ -706,6 +775,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)) ; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -716,6 +786,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
int arg4; \
|
||||
const char *arg5; \
|
||||
|
|
@ -732,6 +803,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)) ; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -742,6 +814,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
const char *arg4; \
|
||||
\
|
||||
|
|
@ -756,6 +829,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -766,6 +840,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
const char *arg3; \
|
||||
int arg4; \
|
||||
|
|
@ -779,6 +854,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -791,6 +867,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
int arg3; \
|
||||
const char *arg4; \
|
||||
|
|
@ -805,6 +882,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg2); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -815,6 +893,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
const char *arg2; \
|
||||
int arg3; \
|
||||
|
|
@ -825,7 +904,8 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
const intype1 arg1 = pycap_get< intype1 > (obj1); \
|
||||
_CHECK_PYCAP(arg1); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -837,6 +917,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
const char *arg4; \
|
||||
int arg5; \
|
||||
|
|
@ -852,6 +933,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -865,6 +947,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
int arg4; \
|
||||
const char *arg5; \
|
||||
|
|
@ -881,6 +964,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5, arg6)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -891,6 +975,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3, *obj4; \
|
||||
const char *arg5; \
|
||||
int arg6; \
|
||||
|
|
@ -908,6 +993,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg4); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5, arg6)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -919,6 +1005,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj3, *obj4; \
|
||||
const char *arg2; \
|
||||
const char *arg5; \
|
||||
|
|
@ -935,6 +1022,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg4); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5, arg6)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -945,6 +1033,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
int arg4; \
|
||||
\
|
||||
|
|
@ -959,6 +1048,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
_CHECK_PYCAP(arg3); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -969,6 +1059,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3, *obj4; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OOOO", &obj1, &obj2, &obj3, &obj4)) \
|
||||
|
|
@ -983,6 +1074,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
const intype4 arg4 = pycap_get< intype4 > (obj4); \
|
||||
_CHECK_PYCAP(arg4); \
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -993,6 +1085,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3, *obj4; \
|
||||
const char *arg5; \
|
||||
\
|
||||
|
|
@ -1009,6 +1102,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
_CHECK_PYCAP(arg4); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1019,6 +1113,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj3, *obj4; \
|
||||
intype2 arg2 ; \
|
||||
const char *arg5; \
|
||||
|
|
@ -1034,6 +1129,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
_CHECK_PYCAP(arg4); \
|
||||
\
|
||||
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1045,6 +1141,7 @@ _w ## func (PyObject *self, PyObject *args)
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OO", &obj1, &obj2)) \
|
||||
|
|
@ -1059,6 +1156,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1, arg2v, arg2n); \
|
||||
delete [] arg2v ; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1070,6 +1168,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
int arg2; \
|
||||
\
|
||||
|
|
@ -1084,6 +1183,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1v, arg1n, arg2); \
|
||||
delete [] arg1v; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1095,6 +1195,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "O", &obj1)) \
|
||||
|
|
@ -1108,6 +1209,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1v, arg1n); \
|
||||
delete [] arg1v; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1119,6 +1221,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
int arg3; \
|
||||
\
|
||||
|
|
@ -1135,6 +1238,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1, arg2v, arg2n, arg3); \
|
||||
delete [] arg2v ; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1147,6 +1251,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2; \
|
||||
int arg3; \
|
||||
\
|
||||
|
|
@ -1163,6 +1268,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
func (arg1, arg2v, arg2n, arg3); \
|
||||
delete [] arg2v ; \
|
||||
Py_RETURN_NONE; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1174,6 +1280,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj3; \
|
||||
int arg2; \
|
||||
\
|
||||
|
|
@ -1190,6 +1297,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1, arg2, arg3v, arg3n); \
|
||||
delete [] arg3v ; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1201,6 +1309,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
\
|
||||
if (!PyArg_ParseTuple(args, "OOO", &obj1, &obj2, &obj3)) \
|
||||
|
|
@ -1218,6 +1327,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1, arg2, arg3v, arg3n); \
|
||||
delete [] arg3v ; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1229,6 +1339,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
PyObject *obj1, *obj2, *obj3; \
|
||||
const char *arg4; \
|
||||
\
|
||||
|
|
@ -1247,6 +1358,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
outtype ret = func (arg1, arg2, arg3v, arg3n, arg4); \
|
||||
delete [] arg3v ; \
|
||||
return ctor_ ## outtype (ret); \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1259,6 +1371,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
static PyObject * \
|
||||
_w ## func (PyObject *self, PyObject *args) \
|
||||
{ \
|
||||
_TRY \
|
||||
intype1 arg1; \
|
||||
\
|
||||
if (!(arg1 = get_object_arg<intype1>(args))) \
|
||||
|
|
@ -1268,6 +1381,7 @@ _w ## func (PyObject *self, PyObject *args) \
|
|||
PyObject *ret = PyUnicode_FromString(val); \
|
||||
LLVMDisposeMessage(const_cast<char*>(val)); \
|
||||
return ret; \
|
||||
_CATCH_ALL \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue