renpy / pygame_sdl2

Reimplementation of portions of the pygame API using SDL2.
GNU Lesser General Public License v2.1
325 stars 63 forks source link

Fix file object to SDL_RWops handle leak #128

Closed uyjulian closed 3 years ago

uyjulian commented 3 years ago

When a file-like object is passed to RWopsFromPython, the file handle should be closed with SDL_RWops.
However, the real file object optimization bypasses this and creates its own SDL_RWops based on the real file object information, so the real file object should be closed as soon as it is passed into RWopsFromPython.

renpytom commented 3 years ago

I don't think this is really a handle leak - garbage collection will close the handle when it happens, which is usually pretty fast. That being said, I don't see a reason not to accept this.