[New-bugs-announce] [issue36767] Segmentation fault when running c extension on macOS

Senhui Guo report at bugs.python.org
Wed May 1 09:49:57 EDT 2019


New submission from Senhui Guo <guo.leciel at gmail.com>:

I was trying to build a c extension with cpython while it keeps crashing when I get it running, the code is quite simple:
```cpp
#include "Python.h"

int main ()
{
    PyObject *p;
    p = PySet_New(NULL);
}
```

I build with command `clang -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m test.c -o run`
when I ran it `./run`, segmentation fault: 11 kicks in
However, if I go with python2, it worked fine:
`clang -I /usr/local/Cellar/python\@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7 -L /usr/local/opt/python\@2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/ -lpython2.7 test.c -o run`

I was wondering if it is the problem with macOS? I tried build python from source, but didn't work, keeps crashing

----------
components: macOS
messages: 341196
nosy: Senhui Guo, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Segmentation fault when running c extension on macOS
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36767>
_______________________________________


More information about the New-bugs-announce mailing list