SWIGINTERN PyObject *_wrap_recv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; char *arg2 = (char *) 0 ; size_t arg3 ; int arg4 ; int val1 ; int ecode1 = 0 ; int res2 ; Py_ssize_t size2 = 0 ; void *buf2 = 0 ; int val4 ; int ecode4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; int result; if (!PyArg_ParseTuple(args,(char *)"OOO:recv",&obj0,&obj1,&obj2)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "recv" "', argument " "1"" of type '" "int""'"); } arg1 = (int)(val1); { res2 = PyObject_AsWriteBuffer(obj1, &buf2, &size2); if (res2<0) { PyErr_Clear(); SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "recv" "', argument " "2"" of type '" "(char *buf2, size_t len)""'"); } arg2 = (char *) buf; arg3 = (size_t) (size2/sizeof(char)); } ecode4 = SWIG_AsVal_int(obj2, &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "recv" "', argument " "4"" of type '" "int""'"); } arg4 = (int)(val4); result = (int)nn_recv(arg1,arg2,arg3,arg4); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: return NULL; }
The arg2 = (char *) buf; is incorrect (and does not compile) as "buf" does not exist.
I'm guessing that it should be "buf2" instead of "buf". The related macro pybuffer_binary generates as such.
Hm... should probably specify what declarations were used to get this error :)
Also, sorry about the -small usage, realized that after posting.
What is the complete code to replicate this?
I don't have it accessible right now, but it is in essence only including the nn.h header (nanomsg.org) and then the above type mapping for nn_recv. I haven't tried stripping it to the minimum that still generates the error.
Tomorrow I can paste the complete .i-file.
Nope the only part needed is what I mentioned in my first comment.
The minimal is this:
This will generate the following code:
Where this is the problem part:
I assume should be "buf1". (buf2 in my original post since I had another argument in front of it)
Last edit: tatsujin 2013-09-19
Diff:
This was fixed in SWIG 4.0.0 by 3594e54f7edb364369971b12a395ad2eff617515.