On Python <= 3.11, pathlib._NormalAccessor captures io.open (and os.* mutators) into class attributes at pathlib import time. A C builtin captured there does not bind on instance access, but a Python wrapper does: self shifts into the next positional, so Path.open / Path.write_text raised 'open() argument mode must be str, not PosixPath' once the guard had replaced io.open with a Python wrapper before pathlib was imported. (3.12+ dropped the accessor, which is why it only failed on the 3.10 CI leg.) Import io and pathlib at the top of the guard, before any patching, so the accessor captures the original builtins, and confine Path.open by wrapping the public method directly (mode-aware) rather than relying on the io.open patch to reach it. Direct io.open() writers are still guarded for the zipfile-based cases. |
||
|---|---|---|
| .. | ||
| backend | ||
| frontend | ||
| src-tauri | ||
| __init__.py | ||
| install_llama_prebuilt.py | ||
| install_node_prebuilt.py | ||
| install_python_stack.py | ||
| LICENSE.AGPL-3.0 | ||
| node_prebuilt_pins.json | ||
| package-lock.json | ||
| package.json | ||
| setup.bat | ||
| setup.ps1 | ||
| setup.sh | ||
| Unsloth_Studio_Colab.ipynb | ||