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?
Stefan, could you look at this please? Looks like it is only used with -builtin.
Yes, I'll look at this. I remember that this implementation was uglier than I thought it should be. I'll see if I can fix it to avoid the encoding-specific stuff.
Stefan
After some thought, I concluded that this issue isn't fixable when -builtin is used. But I added an #ifdef around SWIG_Python_NonDynamicSetAttr, so the issue goes away if you're not using -builtin.
Committed as revision 12842, will go into version 2.0.5.