mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1869] tools/shader_carve_accel: release non-readonly/empty buffer pins and guard native fallback #1881
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1881
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1869
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/shader-carve-accel-safety📝 Commits (1)
7e38f9bHarden shader_carve_accel buffer release, native lookup, and fallback checks📊 Changes
2 files changed (+183 additions, -4 deletions)
View changed files
➕
tests/test_shader_carve_accel.py(+162 -0)📝
tools/shader_carve_accel.py(+21 -4)📄 Description
Claimed in the coordination issue as: SHADER-CARVE-ACCEL-SAFETY-AND-UNIT-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164153026)
What and why
path.is_file()before callingctypes.CDLLin_load_native()(tools/shader_carve_accel.py) so a missing optional native binary returnsNonecleanly.false,off, andno(case-insensitive, stripped) identically to0forLEONIDA_SHADER_CARVE_NATIVE.Py_bufferpin inentry_search()whennot view.readonly,view.len <= 0, ornot view.bufso writable (bytearray/ writablemmap) and empty buffers do not stay pinned on fallback, and guardfinallycleanup against double-release.isinstance(pos, int) and not isinstance(pos, bool) and 0 <= pos < view.lenbefore invoking nativescan, and also catchTypeError/OverflowErrorwhen falling back cleanly toreference(pos).tests/test_shader_carve_accel.py.Tested
python -I tests/test_shader_carve_accel.py -v->Ran 4 tests in 0.015s(OK);python -I tests/test_shader_carve.py -v->Ran 31 tests in 1.434s(OK);python -I tests/test_shader_carve_native.py -v->Ran 3 tests in 0.016s(OK (skipped=1),NativeParityTestskipped because the optional compiled native library is not present on this host).upstream/main5e95fa2fwithtests/test_shader_carve_accel.pycopied into detached worktree):Ran 4 tests in 0.012s(FAILED (failures=6, errors=2)).python -I tests/test_ci_registration.py(Ran 16 tests in 5.145s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 12.917s,OK),python -I scripts/check_no_game_data.py(exit 0),python -I -m compileall -q(exit 0),git diff --check(exit 0).GPUs tested: n/a (Py_buffer lifetime, fallback, and native-scanner safety unit tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.