Date: Mon, 24 Aug 2015 23:11:32 +0200 From: David Naylor <dbn@freebsd.org> To: freebsd-python@freebsd.org Subject: ctypes not working (Fwd: [pypy-dev] 2.6.1 and freebsd-9) Message-ID: <1770820.q6b9lEKF14@dragon.local>
next in thread | raw e-mail | index | archive | help
--nextPart6993704.WiLQnoTmjT Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Hi list, Please see the correspondence below from the pypy team about some faili= ng=20 tests. Specifically, why is test.py producing None whereas test.c is=20= producing the desired results? =20 Regards =2D--------- Forwarded Message ---------- Subject: Re: [pypy-dev] 2.6.1 and freebsd-9 Date: Monday, 24 August 2015, 23:07:20 From: David Naylor <naylor.b.david@gmail.com> To: pypy-dev@python.org CC: Matti Picus <matti.picus@gmail.com> On Saturday, 22 August 2015 21:25:44 Matti Picus wrote: > I would like to add the freebsd-9-x86-64 binary tgz to our released > downloads. We still have a number of failing tests showing up on > http://buildbot.pypy.org/summary?category=3Dfreebsd64 > among them many > DLOpenError: "opening 'libm.so' with ctypes.CDLL() works, but not wit= h > c_dlopen()??" > and the more worrying SIGSEGV in > http://buildbot.pypy.org/summary/longrepr?testname=3Dunmodified&build= er=3Dpypy-c > -jit-freebsd-9-x86-64&build=3D655&mod=3Dlib-python.2.7.test.test_io >=20 > Could someone proficient in freebsd suggest what is going on? Hi Matti, I am able to reproduce this on FreeBSD 10.2: # cat > test.py << __EOF from=20ctypes import * libc =3D CDLL("libc.so.7") dlopen =3D libc["dlopen"] # see <dlfnc.h>: void *dlopen(const char *, int); dlopen.argtypes =3D [c_char_p, c_int] dlopen.restype =3D c_void_p print dlopen(c_char_p("libm.so"), c_int(0)) __EOF # python test.py None However, contract this with the C equivalent: # cat > test.c << __EOF #include <dlfcn.h> #include <stdio.h> int main(int argc, char** argv) { printf("%p\n", dlopen("libm.so", RTLD_LOCAL)); } __EOF # cc -o test test.c # ./test 0x800620800 <snip/> --nextPart6993704.WiLQnoTmjT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAABCgBmBQJV24iEXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ5NDhFQzUxMUEyN0YwMzAyRTc5OUI1M0FB RDYzRkE4REQ2QjJEQTU1AAoJEK1j+o3WstpVLr0P/0Cx2uR+p04Y+51JbTGZXeNr LSj23qbP10FIHUc1oGJh5f8MUJBVl7zH+fA9hjek4ZTg8aNx8h02f43E4z7oEO+T MLuqgqpLufOk2e9D8gXw7g8hJGDY2OlTDAJ8gnhqWj4gLc2dpLZAAyXz6LJVa61m 5uBFyQ5SqC3IPyYzpPDzn2ZOLbXoLQWe4msE9O5TJMXgVtylRNEvs4p/oVGOOw8u QGHUFcemi2BKfoNAyEQ0AZOobtSyINnSpYwd2wqkY448WzDClwOF8Oi6Ts7ybppY eLPRywqM7DKgqW8TyQBE/n+LxIDZKOsHucxxoV+8oRJlPUmQl0AqcfYtp/kJUtVE sz2RubtKMrNEqfm30uX0KLPpQtZDItaSltnXvWMpB4qEcrpEUGw9B8ez5+LkWgNl wXtrehISqH4PyZqbLG1LISgD3Drv/8OaBfbeLqH5UI3cxO0oWYtvlA0HeHShTD/D ZTr44qF9mnN+qoFzq7LYJGLAyLlk1EsXh8EUL9zzVs6xHPEmHoTt9WUvIxQrTIsl 9mPhzuIMBpyRXDpKOk5ldH0Ma6X7HFYlnE/iasYR1chx8OW6bKUPATx50+7DR5oa xs56D83DUgSgW7/jp/ap+VzXFGTPcHRwG7lCj0YBUe8yYLTJdY9i4lvJOgHTwITa S1ZK13jIVoYHDHaa7SUt =0Atp -----END PGP SIGNATURE----- --nextPart6993704.WiLQnoTmjT--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1770820.q6b9lEKF14>