Recent SWIG releases include a runtime function, SWIG_Python_NonDynamicSetAttr. This calls a bunch of Python Unicode-handling functions (e.g. PyUnicode_Decode if Py_USING_UNICODE is defined, and PyUnicode_AsUTF8String even if it isn't). This is a nuisance because now when the extension is loaded, the linker tries to look up these functions in the Python .so, and since the Python library comes in both a UCS2 and UCS4 (wide Unicode) variant, the extension now only works if the users of our extension have the same Python variant that we do (or we distribute both UCS2 and UCS4 extensions). It actually turns out that this runtime function isn't called anywhere, at least in our use of SWIG, so we can remove the Python Unicode dependency (and thus not have to distribute two versions of the extension) by removing that function from the wrappers. Is it possible to have SWIG not include that function unless it is actually needed somewhere else, so we don't have to hack our wrappers in this fashion?
Log in to post a comment.