rversteegen left a comment (ohrrpgce/ohrrpgce#1281)

> Hmmm... so in the process of trying to track down exactly where the write was 
> failing to the reloadbasic output file, I happened to add a 
> `print(self.file.tell())` and suddenly the bug went away.

I'm still using Python 3.11. I had a look through the changes in 3.12 and 
notice that there are changes to the GC. I also notice that `DelayedFileWriter` 
creates `FileMarker` reference loops. reloadbasic.py doesn't actually flush or 
close the output file but instead dodgily assumes that it will be 
closed/flushed to disk when the program exits, when all variables are 
finalised. It turns out that this worked in Python 2 but is not reliable in 
Python 3. The reason being the reference loops: in order to clean them up the 
GC has to break references between objects and it can break references inside 
the file object, destroying the buffer without flushing it. See 
https://github.com/python/cpython/issues/62052#issuecomment-1578053631. There 
is a warning in the documentation (which was fixed 
[here](https://github.com/python/cpython/pull/23135/commits/f4bbc4fcafb17da315fbaff662ff5bfa8ff93065):
 you have to close files, not just delete them).

> "Test Game" doesn't work from the bundled app, but maybe that is expected.

It's meant to work if `OHRRPGCE-Game.app` is next to `OHRRPGCE-Custom.app`. 
Anything in c_debug?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947
You are receiving this because you are subscribed to this thread.

Message ID: <ohrrpgce/ohrrpgce/issues/1281/[email protected]>
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to