This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_ctypes seg fault (test_callback_register_double); armv7; gcc 4.5.1
Type: crash Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, amaury.forgeotdarc, belopolsky, berker.peksag, meador.inge, python272
Priority: normal Keywords:

Created on 2011-07-25 23:37 by python272, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg141131 - (view) Author: (python272) Date: 2011-07-25 23:37
[meego]$/opt/org.python.python-2.7.2/bin/python -m test.regrtest ...
...
test_callback_register_double (ctypes.test.test_callbacks.SampleCallbacksTestCase) ... Segmentation fault

this is after a native (not cross-compile) configure; make; make install on armv7:
== CPython 2.7.2 (default, Jul 25 2011, 11:06:06) [GCC 4.5.1 20100731 (MeeGo 4.5.1-1) [release 4.5-2010.09-1]]
==   Linux-2.6.37-24.5.CE-adaptation-n900-armv7l-with-glibc2.4 little-endian
==   /tmp/test_python_6700
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, unicode=0, bytes_warning=0)

that is the only regrtest seg fault, but there are several worrisome(?) failures in test_ctypes:
...
======================================================================
FAIL: test_longlongresult (ctypes.test.test_functions.FunctionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/org.python.python-2.7.2/lib/python2.7/ctypes/test/test_functions.py", line 167, in test_longlongresult
    self.assertEqual(result, 21)
AssertionError: 10L != 21
...
Ran 335 tests in 3.949s

FAILED (failures=17, errors=1, skipped=1)
test test_ctypes failed -- multiple errors occurred
1 test failed:
    test_ctypes
============

a few other test modules have failures, they appear to be less severe:
test_cmath 
test_float 
#http://bugs.python.org/issue12331
test_lib2to3 
test_math 
test_pyexpat 
test_strtod


=================
note: the arm systems i have access to (meego armv7 & android sl4a/py4a) both natively use python < 2.6.7; forgive my ignorance if 2.7 series is not expected to be mature on arm. please also forgive if i should have just disabled ctypes in setup.py as many of the online (cross-compile) instructions suggest:
disabled_module_list.append('_ctypes')
===============

test_ctypes for a native build of 2.6.7 does not seg fault, but does have the same test failures:
========
...
Ran 327 tests in 3.025s

FAILED (failures=17)
test test_ctypes failed -- multiple errors occurred
1 test failed:
    test_ctypes
msg141478 - (view) Author: (python272) Date: 2011-07-31 22:17
problem also occurs when built with configure option --with-system-ffi
not sure whether it might be a compiler bug or an invalid test?

some debug output:
[@localhost Python-2.7.2]$ gdb ./python
(gdb) run -Wd -3 -E -tt  ./Lib/test/regrtest.py -v test_ctypes

...
test_ushort (ctypes.test.test_callbacks.Callbacks) ... ok
test_callback_register_double (ctypes.test.test_callbacks.SampleCallbacksTestCase) ...
Program received signal SIGSEGV, Segmentation fault.
0x99999998 in ?? ()
(gdb) where
#0  0x99999998 in ?? ()
#1  0x40409718 in _testfunc_cbk_reg_double (a=5.5, b=1.1964487668029418e-47,
    c=1.001023, d=0, e=1.5999999999999999e-05, func=0x9999999a)
    at /home/Python-2.7.2/Modules/_ctypes/_ctypes_test.c:39
#2  0x41edc9a0 in ffi_call_SYSV () from /usr/lib/libffi.so.5
#3  0x40160000 in slot_tp_iter (self=Cannot access memory at address 0xffffffe0
) at Objects/typeobject.c:5579
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

the referenced file snippets:

/home/Python-2.7.2/Modules/_ctypes/_ctypes_test.c

     35 EXPORT(double)
     36 _testfunc_cbk_reg_double(double a, double b, double c, double d, double         e,
     37                          double (*func)(double, double, double, double,         double))
     38 {
     39     return func(a*a, b*b, c*c, d*d, e*e);

/home/Python-2.7.2/Objects/typeobject.c

   5567 static PyObject *
   5568 slot_tp_iter(PyObject *self)
   5569 {
   5570     PyObject *func, *res;
   5571     static PyObject *iter_str, *getitem_str;
   5572
   5573     func = lookup_method(self, "__iter__", &iter_str);
   5574     if (func != NULL) {
   5575         PyObject *args;
   5576         args = res = PyTuple_New(0);
   5577         if (args != NULL) {
   5578             res = PyObject_Call(func, args, NULL);
   5579             Py_DECREF(args);
   5580         }
   5581         Py_DECREF(func);
   5582         return res;
   5583     }
msg155566 - (view) Author: (python272) Date: 2012-03-13 04:23
test_ctypes is successful in 2.7.3rc1, armv7l (using --with-system-ffi (3.0.10); i haven't tested w/out that config option)

note:

Python-2.7.3rc1/Modules/_ctypes/libffi/configure
contains this line:
VERSION='3.0.10rc0'

(2.7.2 has the same line)

but upstream libffi 3.0.10 (not rc) has been released for awhile now
msg221820 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-28 22:32
Can this be closed as "out of date" as we're now up to 2.7.7?
msg264038 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-04-23 02:01
2.7 now uses libffi 3.1 and our ARM buildbots are quite healthy so I think we can now close this 'out of date'.
History
Date User Action Args
2022-04-11 14:57:20adminsetgithub: 56849
2016-04-23 02:01:24berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg264038

resolution: out of date
stage: resolved
2014-06-28 22:32:46BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221820
2012-03-13 04:23:45python272setmessages: + msg155566
2012-02-29 13:11:31eric.araujosetnosy: + amaury.forgeotdarc, belopolsky, meador.inge
2011-07-31 22:17:37python272setmessages: + msg141478
2011-07-25 23:37:51python272create