Closed wsfulton closed 5 days ago
There are a few more issues in there, not just SWIG_Python_str_AsChar
.
contrib/python/ldns_wrapper.c: In function ‘_wrap_ldns_rdf_type2str’:
contrib/python/ldns_wrapper.c:10137:16: error: implicit declaration of function ‘SWIG_Python_str_AsChar’; did you mean ‘SWIG_Python_str_FromChar’? [-Werror=implicit-function-declaration]
10137 | arg1_str = SWIG_Python_str_AsChar(swig_obj[0]);
| ^~~~~~~~~~~~~~~~~~~~~~
| SWIG_Python_str_FromChar
contrib/python/ldns_wrapper.c:10137:14: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
10137 | arg1_str = SWIG_Python_str_AsChar(swig_obj[0]);
| ^
contrib/python/ldns_wrapper.c:10157:5: error: implicit declaration of function ‘SWIG_Python_str_DelForPy3’; did you mean ‘SWIG_Python_str_FromFormat’? [-Werror=implicit-function-declaration]
10157 | SWIG_Python_str_DelForPy3(arg1_str); /* Is a empty macro for Python < 3. */
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| SWIG_Python_str_FromFormat
contrib/python/ldns_wrapper.c: In function ‘_wrap_ldns_rdf_data_as_bytearray’:
contrib/python/ldns_wrapper.c:10183:14: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
10183 | arg1_str = SWIG_Python_str_AsChar(swig_obj[0]);
| ^
contrib/python/ldns_wrapper.c: In function ‘_wrap_ldns_buffer_skip’:
contrib/python/ldns_wrapper.c:11857:43: warning: passing argument 2 of ‘SWIG_AsVal_long’ from incompatible pointer type [-Wincompatible-pointer-types]
11857 | arg2_res = SWIG_AsVal_long(swig_obj[1], &arg2);
| ^~~~~
| |
| ssize_t * {aka int *}
contrib/python/ldns_wrapper.c:3551:39: note: expected ‘long int *’ but argument is of type ‘ssize_t *’ {aka ‘int *’}
3551 | SWIG_AsVal_long (PyObject *obj, long* val)
| ~~~~~~^~~
There are a few more issues in there, not just
SWIG_Python_str_AsChar
.
Yes, SWIG_Python_str_DelForPy
is intimately linked to this and is dealt with in the patch in the modified freearg
typemap. This function no longer exists and was previously needed for memory cleanup. Memory cleanup is now very different and covered in the new freearg
typemap.
SWIG_Python_str_AsChar needs to be replaced by SWIG_PyUnicode_AsUTF8AndSize. See https://github.com/swig/swig/commit/f89dd59d4b82ece899087682fdb86e94d2611513.
The patch leaves the typemap code unchanged for older versions of SWIG, hence swig-4.2.0 as well as older versions of SWIG can be used.