diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg index 2b82c25bf..edfd26824 100644 --- a/Lib/swigrun.swg +++ b/Lib/swigrun.swg @@ -131,6 +131,7 @@ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) diff --git a/Lib/typemaps/swigtypemaps.swg b/Lib/typemaps/swigtypemaps.swg index e78c53afc..75886c753 100644 --- a/Lib/typemaps/swigtypemaps.swg +++ b/Lib/typemaps/swigtypemaps.swg @@ -133,7 +133,7 @@ * ----------------------------------------------------------------------------- */ #define %error_block(Block...) %block(Block) -#define %default_code(code) ((code != SWIG_ERROR) ? code : SWIG_TypeError) +#define %default_code(code) SWIG_ArgError(code) #define %argument_fail(code, type, name, argn) SWIG_exception_fail(%default_code(code), %argfail_fmt(type, name, argn)) #define %argument_nullref(type, name, argn) SWIG_exception_fail(SWIG_ValueError, %argnullref_fmt(type, name, argn)) #define %variable_fail(code, type, name) SWIG_exception_fail(%default_code(code), %varfail_fmt(type, name))