fix(engine): UTF-8 filesystem encoding, --run-forever in --help, honest step() docs
Three documentation-adjacent defects, found while auditing what the July bugfix
batch obliged the docs to say.
#378 -- init_python_with_config(), the init path main.cpp actually uses, did no
pre-initialization at all. PyPreConfig.utf8_mode was never enabled, so the
filesystem encoding fell back to ASCII while sys.getdefaultencoding() and the
locale both reported UTF-8. open() with no explicit encoding= therefore could not
read a UTF-8 file:
open("notes.py").read()
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2
In any normal CPython 3, open() defaults to UTF-8. This broke any script reading a
data file, a save file, or its own source. init_python() -- the other init path --
had always set utf8_mode = 1; only the live path was missing it.
This also corrects the long-standing folklore that "--exec scripts must be
ASCII-only". They need not be, and never did: the C++ side reads the file and hands
the bytes to Python, which parses them as UTF-8 per PEP 3120. The folklore was
pointing at open(), via harnesses that read scripts themselves.
--run-forever (#350) parsed but was absent from print_help(), which lists every
other McRogueFace flag. The only place a user could learn it existed was the
runtime error printed after their script had already failed. CLI flags are not in
the API manifest, so nothing flagged the omission.
mcrfpy.step()'s docstring still read "Advance simulation time" -- accurate until
30abb0b made step() a full simulation frame (scene update, Python Scene.update(),
timers, animations, transition completion, frame metrics, currentFrame++). It now
says so, says why render and input are deliberately excluded, and states the
sys.exit() requirement that --run-forever exists to waive. The most-changed
semantic in the batch had the least-changed documentation.
closes #378
This commit is contained in:
parent
a7ba4867ea
commit
43a6cc376b
4 changed files with 115 additions and 3 deletions
|
|
@ -184,6 +184,8 @@ void CommandLineParser::print_help() {
|
|||
<< "McRogueFace specific options:\n"
|
||||
<< " --exec file : execute script before main program (can be used multiple times)\n"
|
||||
<< " --headless : run without creating a window (implies --audio-off)\n"
|
||||
<< " --run-forever : keep running after --exec scripts finish, instead of\n"
|
||||
<< " exiting (for a long-lived headless process)\n"
|
||||
<< " --audio-off : disable audio\n"
|
||||
<< " --audio-on : enable audio (even in headless mode)\n"
|
||||
<< " --screenshot [path] : take a screenshot in headless mode\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue