diff --git a/SWIG/Lib/python/pyprimtypes.swg b/SWIG/Lib/python/pyprimtypes.swg index 81947d156..0d0e3b7b7 100644 --- a/SWIG/Lib/python/pyprimtypes.swg +++ b/SWIG/Lib/python/pyprimtypes.swg @@ -541,7 +541,7 @@ SWIGINTERN int long v; if (SWIG_AsVal(long)(obj, &v)) { if (SWIG_CheckLongInRange(v, WCHAR_MIN, WCHAR_MAX, errmsg)) { - if (val) *val = v; + if (val) *val = SWIG_numeric_cast(v, wchar_t); return 1; } else { return 0; diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index d4dfd586a..7c9cc959c 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -1160,7 +1160,7 @@ public: outarg = NewString(""); kwargs = NewString(""); - Wrapper_add_local(f,"resultobj", "PyObject *resultobj"); + Wrapper_add_local(f,"resultobj", "PyObject *resultobj = NULL"); /* Write code to extract function parameters. */ emit_args(d, l, f); @@ -1626,7 +1626,7 @@ public: /* Create a function for getting the value of a variable */ Printf(getf->def,"static PyObject *%s_get(void) {", wname); - Wrapper_add_local(getf,"pyobj", "PyObject *pyobj"); + Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = NULL"); if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) { Replaceall(tm,"$source",name); Replaceall(tm,"$target","pyobj");