classification
Title: ctypes tests fail with clang on non-OS X
Type: Stage:
Components: ctypes Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, benjamin.peterson, djc, doko, georg.brandl, larry, meador.inge, ronaldoussoren
Priority: release blocker Keywords:

Created on 2013-02-05 16:24 by djc, last changed 2013-03-21 17:21 by benjamin.peterson. This issue is now closed.

Messages (11)
msg181454 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2013-02-05 16:24
I recently filed http://llvm.org/bugs/show_bug.cgi?id=15153, prompted by https://bugs.gentoo.org/show_bug.cgi?id=427338 (for 2.7, and https://bugs.gentoo.org/show_bug.cgi?id=427330 for 3.2), for which I found http://bugs.python.org/issue9852. Similar issues have subsequently been found in http://bugs.python.org/issue13370. The latter has been fixed in http://hg.python.org/cpython/rev/a425f2697273 (for 2.7 -- other branches were affected as well), but that fix is incorrectly scoped to just OS X.

It looks like clang is actually right here, and gcc is wrong; see their bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46942 (clang has a bug for this at http://llvm.org/bugs/show_bug.cgi?id=15153).
msg181483 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-02-05 21:10
The changes in CPython mentioned by you are in bundled copy of libffi for OS X (Modules/_ctypes/libffi_osx).
You probably should report the problem to libffi upstream.
Gentoo ebuilds of CPython use --with-system-ffi option, so any fixes in bundled copy of libffi (Modules/_ctypes/libffi) would not help in Gentoo.
msg181499 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2013-02-06 07:52
Thanks, I've filed https://github.com/atgreen/libffi/issues/29.
msg181500 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-02-06 08:01
I don't know how the main copy of libffi in the CPython tree is updated, and if it is a straight copy of the upstream release. Given the mercurial log I'd guess that Modules/_ctypes/libffi is libffi 3.0.11 with a small patch in Modules/_ctypes/libffi.diff.

As Arfrever notes libffi_osx is used on OSX only, and that version is a fork of libffi shared with PyObjC (that is, I try to update the copy in the CPython tree whenever I have to update the copy for PyObjC). 

I agree that the issue with libffi should be fixed upstream first,  otherwise it would get harder and harder to import new upstream versions.
msg181501 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2013-02-06 08:10
Is there a particular reason for not upstreaming the PyObjC changes?
msg181510 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-02-06 12:29
I'm planning to update the tip to the next libffi release candidate once it's released. 

Once this is checked in, maybe revisit the extra copy for OS X; an ABI issue with llvm/clang was identified in
http://sourceware.org/ml/libffi-discuss/2013/msg00012.html

and a work-around provided in
http://sourceware.org/ml/libffi-discuss/2013/msg00021.html
msg181513 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-02-06 12:53
Matthias: libffi_osx already contains the workaround you refer to.

libffi_osx is the same as the variant of libffi included with PyObjC, and that is derived from the system libffi on OSX (IIRC the last time I merged their changes was around 10.7). 

The system libffi on OSX is a fork of the upstream one, at least partially because upstream didn't support darwin/i386 at the time of the fork.
msg181734 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2013-02-09 12:52
libffi now has this fix:

https://github.com/atgreen/libffi/commit/6a790129427121f7db2d876e7218a3104e6d2741

Can someone test with that?
msg181949 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2013-02-12 09:00
libffi-3.0.12 has been released with that fix. Perhaps that should be included in future Python releases?
msg181959 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2013-02-12 14:34
libffi-3.0.12 is now imported, tracked in issue #17192.
msg184888 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-03-21 17:21
Fixed by libffi-3.0.13 import.
History
Date User Action Args
2013-03-21 17:21:47benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg184888
2013-02-12 14:34:39dokosetmessages: + msg181959
2013-02-12 09:00:05djcsetpriority: normal -> release blocker
nosy: + larry, benjamin.peterson, georg.brandl
messages: + msg181949

2013-02-09 12:52:33djcsetmessages: + msg181734
2013-02-06 12:53:09ronaldoussorensetmessages: + msg181513
2013-02-06 12:29:00dokosetmessages: + msg181510
2013-02-06 08:10:44djcsetmessages: + msg181501
2013-02-06 08:01:49ronaldoussorensetnosy: + doko
messages: + msg181500
2013-02-06 07:52:31djcsetmessages: + msg181499
2013-02-05 21:10:21Arfreversetnosy: + Arfrever
messages: + msg181483
2013-02-05 16:48:53ned.deilysetnosy: + ronaldoussoren, meador.inge
2013-02-05 16:24:11djccreate