Antoine Pitrou <pit...@free.fr> added the comment:

Ok, the issue here is that you can't call Py_SetPath() on the point returned by 
Py_GetPath(), since the memory refered to that pointer is free()d at the 
beginning of Py_SetPath(). The following works, though:

main(int argc, char **argv)
{
  wchar_t *path, *newpath;
  path = Py_GetPath();
  newpath = malloc((wcslen(path) + 1) * sizeof(wchar_t));
  wcscpy(newpath, path);
  Py_SetPath(newpath);
  free(newpath);
  printf("Init\n");
  Py_Initialize();
  printf("-- END\n");
}


Perhaps we could modify Py_SetPath() so that it copies the new path first 
before deallocating the old one, but I'm not sure I see the point of calling 
Py_SetPath() with the pointer returned by Py_GetPath().

----------
versions: +Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11320>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to