Improved error message. Contributed by Zooka.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4964 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-07-28 22:04:15 +00:00
commit 13142e8184

View file

@ -276,8 +276,8 @@ cobject:
type_error:
if (flags & SWIG_POINTER_EXCEPTION) {
if (ty) {
char *temp = (char *) malloc(64+strlen(ty->name));
sprintf(temp,"Type error. Expected %s", ty->name);
char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
PyErr_SetString(PyExc_TypeError, temp);
free((char *) temp);
} else {
@ -309,8 +309,8 @@ type_error:
if (flags) {
if (ty) {
char *temp = (char *) malloc(64+strlen(ty->name));
sprintf(temp,"Type error. Expected %s", ty->name);
char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
PyErr_SetString(PyExc_TypeError, temp);
free((char *) temp);
} else {