C++: Py_CompileString crash

Christian Heimes lists at cheimes.de
Mon Oct 26 13:06:47 EDT 2009


KillSwitch wrote:
> int main(int argc, char *argv[])
> {
> 	Py_Initialize();
> 
> 	const char* filename = "asdf.py";
> 
> 	const char* str = "print('lol')";
> 
> 	Py_CompileString(str, filename, 0);
> 
> 	Py_Finalize();
> 	system("PAUSE");
> 	return 0;
> }
> 
> On running, it immediately crashes.

0 is wrong here, see
http://docs.python.org/c-api/veryhigh.html?highlight=py_compilestring#Py_CompileStringFlags

Christian




More information about the Python-list mailing list