P
PlayDough
I am using ActivePython 2.5.1 (python --version returns 'Python
2.5.1') and I am trying to embed/extend. It is segfaulting in
vgetargkeywords during the call to Py_Initialize().
Now, we are using a non-standard configuration, and perhaps some
explanation is in order. Here's our system config (via 'uname -a' with
the hostname stripped):
Linux xxx.xxx.com 2.6.9-67.0.4.ELsmp #1 SMP Fri Jan 18 05:00:58
EST 2008 i686 i686 i386 GNU/Linux
Or from the syslog:
Linux version 2.6.9-67.0.4.ELsmp (brewbuilder@hs20-
bc2-4.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-9))
#1 SMP Fri Jan 18 05:00:58 EST 2008
I've already run into the problem linking because of the __ctype_b
issue, but I think I've worked around that with '-Wl,-wrap' (at least
it links). Here's the compilation command line I am doing:
gcc -ggdb -O0 `python-config --includes` -o main main.c `python-
config --ldflags` -Wl,-wrap,__ctype_b -Wl,-wrap,__ctype_tolower -Wl,-
wrap,__ctype_toupper
Where GCC is:
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)
And the code is just a single call to Py_Initialize(). There is the
additional code to handle the wrap of __ctype_b:
#include
#include
int main(int argc, char *argv[])
{
Py_Initialize();
return 0;
}
__const unsigned short int **__wrap___ctype_b(void)
{
return __ctype_b_loc();
}
__const __int32_t **__wrap___ctype_tolower(void)
{
return __ctype_tolower_loc();
}
__const __int32_t **__wrap___ctype_toupper(void)
{
return __ctype_toupper_loc();
}
So, after compiling, when I run it it coredumps with a segfault.
Looking at the stack trace with gdb yields:
GNU gdb Red Hat Linux (6.3.0.0-1.153.el4_6.2rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License,
and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
warning: exec file is newer than core file.
Core was generated by `./sharc2'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/tls/libpthread.so.0...done.
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libutil.so.1...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0 0x080efbe3 in vgetargskeywords (args=0x40032c5c, keywords=0x0,
format=0x812bf04 "|OOOi:__import__", kwlist=0x814ff84,
p_va=0xbffff1c4,
flags=0) at Python/getargs.c:1382
1382 Python/getargs.c: No such file or directory.
in Python/getargs.c
(gdb) bt
#0 0x080efbe3 in vgetargskeywords (args=0x40032c5c, keywords=0x0,
format=0x812bf04 "|OOOi:__import__", kwlist=0x814ff84,
p_va=0xbffff1c4,
flags=0) at Python/getargs.c:1382
#1 0x080efab1 in PyArg_ParseTupleAndKeywords (args=0x40032c5c,
keywords=0x0,
format=0x812bf03 "s|OOOi:__import__", kwlist=0x814ff84)
at Python/getargs.c:1251
#2 0x080d6551 in builtin___import__ (self=0x0, args=0x40032c5c,
kwds=0x0)
at Python/bltinmodule.c:44
#3 0x0808ca6b in PyCFunction_Call (func=0x40025e6c,
arg=0x40032c5c, kw=0x0)
at Objects/methodobject.c:77
#4 0x080634d9 in PyObject_CallFunctionObjArgs
(callable=0x40025e6c)
at Objects/abstract.c:1860
#5 0x080f46f7 in PyImport_Import (module_name=0x40032b38)
at Python/import.c:2570
#6 0x080f5319 in PyImport_ImportModule (name=0x8122fcb
"__builtin__")
at Python/import.c:1966
#7 0x0806f879 in _PyExc_Init () at Objects/exceptions.c:2061
#8 0x0804d5c9 in Py_InitializeEx (install_sigs=1) at Python/
pythonrun.c:228
#9 0x0804f43d in Py_Initialize () at Python/pythonrun.c:321
#10 0x0804d2c9 in main (argc=1, argv=0xbffff474) at main.c:22
Any ideas what is causing this problem? It appears to be while
importing the __builtin__ package, but beyond that I'm not sure.
2.5.1') and I am trying to embed/extend. It is segfaulting in
vgetargkeywords during the call to Py_Initialize().
Now, we are using a non-standard configuration, and perhaps some
explanation is in order. Here's our system config (via 'uname -a' with
the hostname stripped):
Linux xxx.xxx.com 2.6.9-67.0.4.ELsmp #1 SMP Fri Jan 18 05:00:58
EST 2008 i686 i686 i386 GNU/Linux
Or from the syslog:
Linux version 2.6.9-67.0.4.ELsmp (brewbuilder@hs20-
bc2-4.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-9))
#1 SMP Fri Jan 18 05:00:58 EST 2008
I've already run into the problem linking because of the __ctype_b
issue, but I think I've worked around that with '-Wl,-wrap' (at least
it links). Here's the compilation command line I am doing:
gcc -ggdb -O0 `python-config --includes` -o main main.c `python-
config --ldflags` -Wl,-wrap,__ctype_b -Wl,-wrap,__ctype_tolower -Wl,-
wrap,__ctype_toupper
Where GCC is:
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)
And the code is just a single call to Py_Initialize(). There is the
additional code to handle the wrap of __ctype_b:
#include
#include
int main(int argc, char *argv[])
{
Py_Initialize();
return 0;
}
__const unsigned short int **__wrap___ctype_b(void)
{
return __ctype_b_loc();
}
__const __int32_t **__wrap___ctype_tolower(void)
{
return __ctype_tolower_loc();
}
__const __int32_t **__wrap___ctype_toupper(void)
{
return __ctype_toupper_loc();
}
So, after compiling, when I run it it coredumps with a segfault.
Looking at the stack trace with gdb yields:
GNU gdb Red Hat Linux (6.3.0.0-1.153.el4_6.2rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License,
and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
warning: exec file is newer than core file.
Core was generated by `./sharc2'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/tls/libpthread.so.0...done.
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libutil.so.1...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0 0x080efbe3 in vgetargskeywords (args=0x40032c5c, keywords=0x0,
format=0x812bf04 "|OOOi:__import__", kwlist=0x814ff84,
p_va=0xbffff1c4,
flags=0) at Python/getargs.c:1382
1382 Python/getargs.c: No such file or directory.
in Python/getargs.c
(gdb) bt
#0 0x080efbe3 in vgetargskeywords (args=0x40032c5c, keywords=0x0,
format=0x812bf04 "|OOOi:__import__", kwlist=0x814ff84,
p_va=0xbffff1c4,
flags=0) at Python/getargs.c:1382
#1 0x080efab1 in PyArg_ParseTupleAndKeywords (args=0x40032c5c,
keywords=0x0,
format=0x812bf03 "s|OOOi:__import__", kwlist=0x814ff84)
at Python/getargs.c:1251
#2 0x080d6551 in builtin___import__ (self=0x0, args=0x40032c5c,
kwds=0x0)
at Python/bltinmodule.c:44
#3 0x0808ca6b in PyCFunction_Call (func=0x40025e6c,
arg=0x40032c5c, kw=0x0)
at Objects/methodobject.c:77
#4 0x080634d9 in PyObject_CallFunctionObjArgs
(callable=0x40025e6c)
at Objects/abstract.c:1860
#5 0x080f46f7 in PyImport_Import (module_name=0x40032b38)
at Python/import.c:2570
#6 0x080f5319 in PyImport_ImportModule (name=0x8122fcb
"__builtin__")
at Python/import.c:1966
#7 0x0806f879 in _PyExc_Init () at Objects/exceptions.c:2061
#8 0x0804d5c9 in Py_InitializeEx (install_sigs=1) at Python/
pythonrun.c:228
#9 0x0804f43d in Py_Initialize () at Python/pythonrun.c:321
#10 0x0804d2c9 in main (argc=1, argv=0xbffff474) at main.c:22
Any ideas what is causing this problem? It appears to be while
importing the __builtin__ package, but beyond that I'm not sure.