[Python] glade per python su Mac (Tiger)

Giorgio Zoppi giorgio.zoppi a gmail.com
Lun 20 Lug 2009 15:28:53 CEST


Perche valgrind si incazza con questo:

#include <stdio.h>
#include <Python.h>

#define RCV_BUF 65500
int
exec_python (const char *filename)
{
  FILE *fp;
  FILE *result;
  int value;
  char buf[256];
  int nchar = 0;
  Py_Initialize ();
  fp = fopen (filename, "r+");
  PyRun_SimpleFile (fp, filename);
  Py_Finalize ();
  fclose(fp);
  return nchar;
}

int
main ()
{
  exec_python("pippo.py");
  return 0;
}


E quando lo eseguo mi da:
==24933==  Address 0x4169010 is 288 bytes inside a block of size 672 free'd
==24933==    at 0x400590A: free (vg_replace_malloc.c:323)
==24933==    by 0x64CFA12: PyObject_Free (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x648FB1E: PyGrammar_AddAccelerators (in
/usr/lib/libpython2.5.so.1.0)
==24933==    by 0x649097F: PyParser_New (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x64909F5: (within /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x6539192: PyParser_ASTFromString (in
/usr/lib/libpython2.5.so.1.0)
==24933==    by 0x65395F2: PyRun_StringFlags (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x65148BB: (within /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x64CBB3C: PyCFunction_Call (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651BCEF: PyEval_EvalFrameEx (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651C83C: PyEval_EvalFrameEx (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651D964: PyEval_EvalCodeEx (in /usr/lib/libpython2.5.so.1.0)
==24933==
==24933== Invalid read of size 4
==24933==    at 0x64CF9E9: PyObject_Free (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x6545842: PyObject_GC_Del (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x64A38F2: (within /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x65393E8: (within /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x6539616: PyRun_StringFlags (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x65148BB: (within /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x64CBB3C: PyCFunction_Call (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651BCEF: PyEval_EvalFrameEx (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651C83C: PyEval_EvalFrameEx (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651D964: PyEval_EvalCodeEx (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x651DBC2: PyEval_EvalCode (in /usr/lib/libpython2.5.so.1.0)
==24933==    by 0x652F80C: PyImport_ExecCodeModuleEx (in
/usr/lib/libpython2.5.so.1.0)


Che e' come se andasse il Python a scrivere valori in aree di memoria
non allocate...
mi manca qualcosa?

-- 
Quiero ser el rayo de sol que cada día te despierta
para hacerte respirar y vivir en me.
"Favola -Moda".


Maggiori informazioni sulla lista Python