Python extension using a C library with one 'hello' function

Veek M vek.m1234 at gmail.com
Tue Nov 4 10:43:42 EST 2014


Jason Swails wrote:

> What operating system are you running this on?  It works fine for me on
> Linux:
Wheezy Debian, Linux deathstar 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 
x86_64 GNU/Linux
gcc (Debian 4.7.2-5) 4.7.2
Python 3.2.3

I ran it through gdb - not very useful:
(gdb) bt
#0  0x000000000055e1bd in PyModule_Create2 ()
#1  0x000000000043a830 in _PyImport_LoadDynamicModule ()
#2  0x0000000000476d84 in ?? ()
#3  0x00000000004aa3f9 in ?? ()
#4  0x0000000000477010 in ?? ()
#5  0x000000000048ee8d in ?? ()
#6  0x00000000004a833b in PyObject_Call ()
#7  0x00000000004b88c9 in PyEval_EvalFrameEx ()
#8  0x00000000004cdee7 in PyEval_EvalCodeEx ()

strace -f python3.2
munmap(0x7f215d4b9000, 4096)            = 0
stat("hello.py", {st_mode=S_IFREG|0644, st_size=22, ...}) = 0
stat("_hello", 0x7fff9bd38110)          = -1 ENOENT (No such file or 
directory)
stat("_hello.cpython-32mu.so", {st_mode=S_IFREG|0755, st_size=19217, ...}) = 
0
open("_hello.cpython-32mu.so", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=19217, ...}) = 0
open("./_hello.cpython-32mu.so", O_RDONLY) = 5
read(5, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\7\0\0\0\0\0\0"..., 832) 
= 832
fstat(5, {st_mode=S_IFREG|0755, st_size=19217, ...}) = 0
getcwd("/root/github/junk/hello", 128)  = 24
mmap(NULL, 2101544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 
0x7f215b71c000
mprotect(0x7f215b71d000, 2093056, PROT_NONE) = 0
mmap(0x7f215b91c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 5, 0) = 0x7f215b91c000
close(5)                                = 0
mprotect(0x7f215b91c000, 4096, PROT_READ) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault




More information about the Python-list mailing list