Hide Forgot
Description of problem: When trying to compile python 3.2 bindings using swig 2.0.3 the compilation fails with: error: cannot convert 'PySliceObject*' to 'PyObject*' for argument '1' to 'int PySlice_GetIndices(PyObject*, Py_ssize_t, Py_ssize_t*, Py_ssize_t*, Py_ssize_t*)' Both swig and python3 are the versions available in Fedora 15. Version-Release number of selected component (if applicable): python3-3.2-1.fc15.x86_64 swig-2.0.3-1.fc15.x86_64 How reproducible: Always Additional info: The changelog from swig upstream http://swig.org/Release/CHANGES.current says: Version 2.0.4 (21 May 2011) =========================== [ ... ] 2011-04-09: szager [Python] Added preprocessor guards for python functions PyUnicode_AsWideChar and PySlice_GetIndices, which changed signatures in python3.2. [ ... ] So updating to version 2.0.4 (or backporting the fix) would solve the problem.
Current swig-2.0.3-1.fc15.x86_64 should work fine, it contains patch for this issue (for example python3 bindings are successfully built in the "znc" package). Can you attach .i file and write commands which you use to generate & compile bindings, please? Thank you in advance.
The patch is incomplete - it doesn't fix the whole problem and at the same time introduces new problems. With the patch, the Fedora 15 swig will generate python 3.2 compatible bindings - but only if the -py3 flag is used. The -py3 flag does not mean "Generate python 3 bindings", but "Generate code with Python 3 specific features" (quoting swig -python -help). The code generated without the -py3 flag should be compilable with python 3 too. Also, code generated using the patched Fedora 15 swig with the -py3 flag only works for python 3.2. If the generated code is transferred to a Fedora 14 host where python3 is python 3.1, the code will not compile. On the other hand the code generated using swig 2.0.4 works as expected: Code generated using swig -python compiles for python 2.x, 3.1 and 3.2 and code generated using swig -python -py3 compiles for both python 3.1 and 3.2. This is the way it is supposed to work.
In summary: There are 5 cases. The following table indicates what works and what doesn't. swig version: 2.0.3 2.0.3 with patch 2.0.4 A. python 2.x + + + B. python 3.1 + + + C. python 3.2 - - + D. python 3.1 with -py3 + - + E. python 3.2 with -py3 - + + Score 3/5 3/5 5/5 So both the original and the patched 2.0.3 supports 3 out of the 5 cases, but the set of 3 is not the same. The patched version fixes one case but at the same time breaks another. So I wouldn't call it neither better nor worse, just different. 2.0.4 on the other hand supports all 5 cases.
Ok, thanks for your analysis, I will update swig to 2.0.4 soon.
swig-2.0.4-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/swig-2.0.4-1.fc15
Package swig-2.0.4-1.fc15: * should fix your issue, * was pushed to the Fedora 15 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing swig-2.0.4-1.fc15' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/swig-2.0.4-1.fc15 then log in and leave karma (feedback).
swig-2.0.4-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.