[pypy-issue] [issue1176] ctypes segmentation fault under osx

Mikhail Kashkin tracker at bugs.pypy.org
Wed Jun 13 21:29:13 CEST 2012


New submission from Mikhail Kashkin <mkashkin at gmail.com>:

I'm using pypy from macports. Today I watched presentation from PyCon and some 
person asks about ctypes support. So I try to test it and found diferences with 
cpython. Here is what I've tried:

% python2.7
Python 2.7.3 (default, Apr 19 2012, 00:55:09) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> libc = ctypes.CDLL("/usr/lib/libc.dylib")
>>> libc.time()
1339614957
>>> dir(libc)
['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', 
'__getattr__', '__getattribute__', '__getitem__', '__hash__', '__init__', 
'__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
'__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'_func_flags_', '_func_restype_', '_handle', '_name', 'time']
>>> 


% pypy-c
Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Jun 09 2012, 14:24:11)
[PyPy 1.9.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``<fijal> answering a question: "no
-- for at least one possible interpretation of your sentence"''
>>>> import ctypes
>>>> libc = ctypes.CDLL("/usr/lib/libc.dylib")
>>>> libc.time()
__main__:1: RuntimeWarning: C function without declared arguments called
zsh: bus error  pypy-c

# interpreter dies here.

% pypy-c
Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Jun 09 2012, 14:24:11)
[PyPy 1.9.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``<arigato> no, normal work is so
much less tiring than vacations''
>>>> import ctypes
>>>> libc = ctypes.CDLL("/usr/lib/libc.dylib")
>>>> libc.printf("1")
__main__:1: RuntimeWarning: C function without declared arguments called
1
>>>> # this time I got warning, but the next command works
>>>> libc.time()
1339615442
>>>> dir(libc)zsh: segmentation fault  pypy-c 

This time dies again, but with segfault.

----------
messages: 4438
nosy: pypy-issue, xen
priority: bug
release: 1.9
status: unread
title: ctypes segmentation fault under osx

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1176>
________________________________________


More information about the pypy-issue mailing list