[Pyrex] Total newbie needs code review

Chris Stromberger chris.stromberger at gmail.com
Mon Sep 12 15:39:47 CEST 2005


On 9/12/05, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Chris Stromberger wrote:
> 
> > I guess this is why pyrex says "Obtaining char * from temporary Python
> > value" when I compile the pyx?
> 
> Pyrex tries to save you from yourself if you do anything
> with a string that looks blatantly dangerous, but it
> can't tell for sure, and sometimes it errs on the side
> of paranoia.
> 
> If it's giving a false alarm, you should be able to
> shut it up by assigning the offending Python string
> to an intermediate variable before doing the char *
> conversion.
> 
> What code is giving this message, exactly?
> 

This line, from my original example:

  def pyfunc(self, pyinputs):
   cdef inputs* cinputs
   cinputs.s = pyinputs.s

Where inputs->s is a char* in the c struct.

-Chris



More information about the Pyrex mailing list