[Bf-python] PyRun_File vs PyRun_String

Martin Poirier theeth at yahoo.com
Sat May 10 18:29:00 CEST 2008


--- On Sat, 5/10/08, Campbell Barton <ideasman42 at gmail.com> wrote:

> From: Campbell Barton <ideasman42 at gmail.com>
> Subject: [Bf-python] PyRun_File vs PyRun_String
> To: "Blender Foundation Python list" <bf-python at blender.org>
> Date: Saturday, May 10, 2008, 11:32 AM
> Hi, yesterday I was looking into a bug where the python file
> had
> windows line endings converted incorrectly.
> Now I'm left wondering why we cant use PyRun_File which
> would be a lot
> easier/faster, then loading the buffer and doing line
> ending checks.
> 
> The comments give this reason, but Im wondering if its
> still valid.
> Id like to know what platforms PyRun_File didnt work on or
> maybe some
> more details from "Python/C API Ref Manual, chapter
> 2"

The comment is very much still valid.

Passing FILE structures across DLLs in windows is NOT a good idea for the aforementioned reason. Not only can it break across different C libs but it *will* break across debug/release.

It could be less of an issue on platforms but I wouldn't want to take the risk.

Martin


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



More information about the Bf-python mailing list