[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] C file pointers and file loading



hi,

Or maybe we should build python with the correct runtime?  ;)

What changes did you have in mind Lenard?  I'm not quite sure how
you'd handle this...

pygame.image.load(open("some_image", "rb"))

I guess you'd implement a sdl file object by wrapping the python
object - rather than just taking the file pointer from the python
object.  I guess that wouldn't be as efficient, because then you'd
need to use the python API to read it, but it would probably be ok.



I think this might work fine for the files... I'm not sure if there
would be any other problems mixing runtimes?  There might be other
problems with this, but I guess we won't find out until we try.
Previously mixing runtimes mainly had issues with files that I could
see.

It sure would make it easier to use the supplied SDL and python rather
than compiling our own.


cheers,



On Thu, May 1, 2008 at 6:58 AM, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx> wrote:
> why wouldn't we continue to do what is done now, and build SDL ourselves
> with the correct runtime?
>
>
>
> On Wed, Apr 30, 2008 at 10:51 AM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
>
> > When pygame.image.load is given a Python file object it passes the C FILE
> pointer on to SDL by calling SDL_RWFromFP in get_standard_rwop in
> rwobject.c. While this has worked so far on Windows it may soon be the case
> that SDL will not use the same C run-time as Python. I tried using an SDL
> linked to msvcrt with a Python linked to msvcr71 and predictably the
> interpreter crashed when loading an image from an open file. Since great
> care has been taken in Pygame to separate SDL memory management from
> Python's it should also be done for file access. I don't suggest
> implementing the changes to rwobject.c immediately, but if it is necessary I
> can will do them.
> >
> > --
> > Lenard Lindstrom
> > <len-l@xxxxxxxxx>
> >
> >
>
>