embedding Python: how to avoid memory leaks?

Wolfgang tds333 at googlemail.com
Fri Mar 10 10:39:24 CET 2006


> >>> I couldn't get the PyRun_*File* calls to work on Windows,
> >>> presumably because of the FILE* problem mentioned in the docs.
> >>
> >> Which compiler do you use?
> >
> > MSVC++ (version 6 from memory -- I do most of my development on
> > the Mac and fire up Virtual PC occasionally to test Win builds).
> Well, I don't really *know*, but it's hard to believe to me that the
> file descriptor format changed within the Microsoft product series.

Yes it is hard to believe but true.
Even debug and release versions have incompatible file pointer.
It's not possible to pass af FILE* from a debug app to the embedded
release python.dll.

A workaround is to create the FILE* with the python api functions and
pass this pointer back to python.

More information about the Python-list mailing list