Python C/API Problem

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Sep 11 18:21:10 EDT 2009


En 2009年9月11日 15:10:45 -0300, Gianfranco Murador 
<mitenick at gmail.com> escribió:
> int main(int argc, char *argv[]) {
> 	Py_Initialize();
>> 	struct _node *node = PyParser_SimpleParseString("from time import
> time,ctime\n"
> 					"print 'Today is',ctime(time())\n",0);
> 	if(node == NULL)
> 	{
> 	printf("Errore nel parsing");
> 	}else{
> 	PyNode_Compile(node, "./prova.pyc");
> 	PyNode_Free(node);
> 	}
>> 	Py_Finalize();
> 	return 0;
> }

> I compile the file without errors, but when i launch the executable i
> have a Segmentation Fault. I'm using the shared library of python
> 2.5.2 under linux.. Any ideas? It's clear that i do some mistakes, but

The second argument to PyParser_SimpleParseString must be one of 
Py_eval_input, Py_file_input or Py_single_input - not 0.
Anyway, if this is the actual cause of your segfault, seems that a 
validation should be added somewhere...
-- 
Gabriel Genellina


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /