<span style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">
<blockquote>
<p dir="auto">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 <code class="notranslate">print(self.file.tell())</code> and suddenly the bug went away.</p>
</blockquote>
<p dir="auto">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 <code class="notranslate">DelayedFileWriter</code> creates <code class="notranslate">FileMarker</code> 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 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1198900112" data-permission-text="Title is private" data-url="https://github.com/python/cpython/issues/62052" data-hovercard-type="issue" data-hovercard-url="/python/cpython/issues/62052/hovercard?comment_id=1578053631&comment_type=issue_comment" href="https://github.com/python/cpython/issues/62052#issuecomment-1578053631">python/cpython#62052 (comment)</a>. There is a warning in the documentation (which was fixed <a href="https://github.com/python/cpython/pull/23135/commits/f4bbc4fcafb17da315fbaff662ff5bfa8ff93065">here</a>: you have to close files, not just delete them).</p>
<blockquote>
<p dir="auto">"Test Game" doesn't work from the bundled app, but maybe that is expected.</p>
</blockquote>
<p dir="auto">It's meant to work if <code class="notranslate">OHRRPGCE-Game.app</code> is next to <code class="notranslate">OHRRPGCE-Custom.app</code>. Anything in c_debug?</p><p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZVRGVUVJZTOPCIQH3T22LMZLAVCNFSM6AAAAABZC32DNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJWHEYDKOJUG4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AMWGWZS2R3AYGF7V2JONRLD22LMZLA5CNFSM6AAAAABZC32DNKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTVH42JNW.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><ohrrpgce/ohrrpgce/issues/1281/2816905947</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
</span>
<div style="display: flex; flex-wrap: wrap; white-space: pre-wrap; align-items: center; "><img height="20" width="20" style="border-radius:50%; margin-right: 4px;" decoding="async" src="https://avatars.githubusercontent.com/u/1165449?s=20&v=4" /><strong>rversteegen</strong> left a comment <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947">(ohrrpgce/ohrrpgce#1281)</a></div>
<blockquote>
<p dir="auto">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 <code class="notranslate">print(self.file.tell())</code> and suddenly the bug went away.</p>
</blockquote>
<p dir="auto">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 <code class="notranslate">DelayedFileWriter</code> creates <code class="notranslate">FileMarker</code> 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 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1198900112" data-permission-text="Title is private" data-url="https://github.com/python/cpython/issues/62052" data-hovercard-type="issue" data-hovercard-url="/python/cpython/issues/62052/hovercard?comment_id=1578053631&comment_type=issue_comment" href="https://github.com/python/cpython/issues/62052#issuecomment-1578053631">python/cpython#62052 (comment)</a>. There is a warning in the documentation (which was fixed <a href="https://github.com/python/cpython/pull/23135/commits/f4bbc4fcafb17da315fbaff662ff5bfa8ff93065">here</a>: you have to close files, not just delete them).</p>
<blockquote>
<p dir="auto">"Test Game" doesn't work from the bundled app, but maybe that is expected.</p>
</blockquote>
<p dir="auto">It's meant to work if <code class="notranslate">OHRRPGCE-Game.app</code> is next to <code class="notranslate">OHRRPGCE-Custom.app</code>. Anything in c_debug?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZVRGVUVJZTOPCIQH3T22LMZLAVCNFSM6AAAAABZC32DNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJWHEYDKOJUG4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AMWGWZS2R3AYGF7V2JONRLD22LMZLA5CNFSM6AAAAABZC32DNKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTVH42JNW.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><ohrrpgce/ohrrpgce/issues/1281/2816905947</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1281#issuecomment-2816905947",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>