C-Module for Python: segmentation violation problems
Sebastian Huber
sebastian-huber at web.de
Wed Aug 7 12:37:00 EDT 2002
Hello,
I write a C-module for Python. This module contains the function
PyObject* execute( PyObject*, PyObject*) which encapsulates a call to
another function (it uses RPC functions and XDR types) which returns a dynamically allocated C-string.
If I want to free this string, I get this error:
#0 0x40029d38 in pthread_mutex_lock () from /lib/libpthread.so.0
#1 0x400d598b in free () from /lib/libc.so.6
#2 0x402361eb in TACOPythonClient::freeOutputArgument (outputType=6, argout=0x8136628) at TACOPythonClient.h:346
#3 0x4023631f in TACOPythonClient::freeArguments (inputType=6, argin=0x811de28, outputType=6, argout=0x8136628) at TACOPythonClient.h:397
#4 0x40237f68 in execute (unused=0x0, args=0x80dc804) at TACOPythonClient.cpp:379
#5 0x0805a841 in PyEval_CallObjectWithKeywords ()
#6 0x08058fb9 in PyEval_EvalCode ()
#7 0x0805ac9f in PyEval_CallObjectWithKeywords ()
#8 0x08059086 in PyEval_EvalCode ()
#9 0x08055fc5 in PyEval_EvalCode ()
#10 0x08072b11 in PyRun_FileExFlags ()
#11 0x080719a5 in PyRun_InteractiveOneFlags ()
#12 0x080717c6 in PyRun_InteractiveLoopFlags ()
#13 0x08071684 in PyRun_AnyFileExFlags ()
#14 0x0805242d in Py_Main ()
#15 0x08051d43 in main ()
If I don't free the string, this arises:
#0 0x400d5c53 in chunk_free () from /lib/libc.so.6
#1 0x400d59a3 in free () from /lib/libc.so.6
#2 0x40235dda in TACOPythonClient::freeScalar (arg=0x811d5e0) at TACOPythonClient.h:273
#3 0x402361e9 in TACOPythonClient::freeOutputArgument (outputType=6, argout=0x811d5e0) at TACOPythonClient.h:346
#4 0x4023630f in TACOPythonClient::freeArguments (inputType=0, argin=0x0, outputType=6, argout=0x811d5e0) at TACOPythonClient.h:396
#5 0x40237f58 in execute (unused=0x0, args=0x80f2174) at TACOPythonClient.cpp:379
#6 0x0805a841 in PyEval_CallObjectWithKeywords ()
#7 0x08058fb9 in PyEval_EvalCode ()
#8 0x0805ac9f in PyEval_CallObjectWithKeywords ()
#9 0x08059086 in PyEval_EvalCode ()
#10 0x08055fc5 in PyEval_EvalCode ()
#11 0x08072b11 in PyRun_FileExFlags ()
#12 0x080719a5 in PyRun_InteractiveOneFlags ()
#13 0x080717c6 in PyRun_InteractiveLoopFlags ()
#14 0x08071684 in PyRun_AnyFileExFlags ()
#15 0x0805242d in Py_Main ()
#16 0x08051d43 in main ()
or this:
#0 0x400d520a in chunk_alloc () from /lib/libc.so.6
#1 0x400d4f64 in malloc () from /lib/libc.so.6
#2 0x0809bd35 in PyString_FromString ()
#3 0x08098971 in PyDict_GetItemString ()
#4 0x08073c1f in PySys_GetObject ()
#5 0x08057ca2 in PyEval_EvalCode ()
#6 0x08055fc5 in PyEval_EvalCode ()
#7 0x08072b11 in PyRun_FileExFlags ()
#8 0x080719a5 in PyRun_InteractiveOneFlags ()
#9 0x080717c6 in PyRun_InteractiveLoopFlags ()
#10 0x08071684 in PyRun_AnyFileExFlags ()
#11 0x0805242d in Py_Main ()
#12 0x08051d43 in main ()
If I free this string in a non Python module, the free works without any problems.
I'm absolutly clueless about the reason of that segmentation violations. In particular the first occurence.
Maybe you have a hint for me.
HAND
Sebastian Huber
More information about the Python-list
mailing list