strange interpreter behavior

Jeff jam at quark.emich.edu
Mon Sep 20 10:30:09 EDT 1999


On Sun, Sep 19, 1999 at 06:38:58PM -0400, Rick Ree wrote:
> I'm writing a python wrapper module for a C++ library.  I have 3 lines
> of code that I run to test a new function:
> 
> import mymodule
> 
> a = mymodule.mytype('hello')
> 
> print a.test()  # should return a list of strings
> 
> 
> When I run this as a script (i.e., 'python testit.py'), everything is
> fine.  But when I invoke the python interpreter and manually type in
> the same code, I get a segfault at a.test().
> 
> I'm baffled at why this is happening.  Does anyone have any clues?
> 
> This is on python 1.5.2, RedHat 5.2.
> 
> thanks
> Rick
> 

hmm.. not too sure without looking at the code. my guess is that there is a
reference problem someplace in your module. try replacing the 'print
a.test()' statement with just 'print a'.. check your reference counting code
(sparse as it may be) for small mistakes. put 'printf's into the C code to
aid in tracing where things might be going wrong.. a segfault means that
some piece of code tried to dereference a NULL pointer. try compiling the
module with '-Wall' and see if that fixes things. if yer still having
trouble, post the code that fails (or mail it directly to me if you'd
rather) and work on things from there.

regards,
J

-- 
|| visit gfd <http://quark.newimage.com/> 
|| psa member #293 <http://www.python.org/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




More information about the Python-list mailing list