Bug 719511 - swig 2.0.3 incompatible with python 3.2
Summary: swig 2.0.3 incompatible with python 3.2
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: swig
Version: 15
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Adam Tkac
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-07 05:40 UTC by Mattias Ellert
Modified: 2013-04-30 23:49 UTC (History)
2 users (show)

Fixed In Version: swig-2.0.4-1.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-22 19:39:30 UTC
Type: ---


Attachments (Terms of Use)

Description Mattias Ellert 2011-07-07 05:40:05 UTC
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.

Comment 1 Adam Tkac 2011-07-07 13:10:18 UTC
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.

Comment 2 Mattias Ellert 2011-07-07 19:59:23 UTC
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.

Comment 3 Mattias Ellert 2011-07-08 07:22:13 UTC
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.

Comment 4 Adam Tkac 2011-07-11 08:15:49 UTC
Ok, thanks for your analysis, I will update swig to 2.0.4 soon.

Comment 5 Fedora Update System 2011-07-11 08:29:05 UTC
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

Comment 6 Fedora Update System 2011-07-12 04:53:19 UTC
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).

Comment 7 Fedora Update System 2011-07-22 19:39:25 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.