Repository navigation
fix(python): a saved mesh that decodes in part warns, the decode releases the GIL, the stub lists every field kind, a failed extension load is an ImportError, and an unread stream's name is quoted (#1884) - #1901
Merged
Conversation
…ases the GIL, the stub lists every field kind, a failed extension load is an ImportError, and an unread stream's name is quoted (#1884) The unread-stream sentence is built in one place (UnreadStream's Display), so rvt-ifc, rvt-gltf, rvt-rs-mcp, the diagnostics and Python all quote the name the file gives it. The GIL is released around the decode, the STEP writer, the diagnostics serialisation and opening a file; a second call on one handle from another thread still raises RuntimeError. No export moves.
…call on it now raises where it used to wait for the GIL (#1884)
DrunkOnJava
marked this pull request as ready for review
November 13, 2026 10:41
Owner
Author
|
Approved at 2257546 by the review bot as a self-approval, under Griffin's answer of 2026-11-12 ("You are allowed to self-approve"): rvtDevelop's session has not read the head sent to it at about 11:40 UTC. I re-read the whole diff (each py.detach call and what it borrows, the warning for a partial saved mesh, the package import, the quoted stream name and the tests that pin it) as if another session had written it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The five findings of #1884 (batch 5's audit of the Python surface), one change each:
export_runraised aRuntimeWarningfor a step that did not run and for none that ran in part; the docs, the stub and the module doc all promised one. It now warns onExportNote::SavedMeshes { partial > 0 }, with the note's own text (N kept their box, their saved graphics not decoding whole).write_ifc,rvt_to_ifc,rvt_to_ifc_diagnostics,schedule_csv,export_diagnostics_json,export_diagnostics,decoded_elements,element_countsand opening a file (RevitFile(path)) ran with it held. The Rust work (the decode, the STEP writer, the diagnostics JSON, the CSV) now runs insidepy.detach; the Python objects and the warnings are built after. A handle is used by one thread at a time: a second call on the sameRevitFilefrom another thread while one runs raisesRuntimeError(pyo3's borrow check), where it used to wait for the GIL and then run. Nothing else is shared across threads that was not.TypedFieldnames the eleven kinds (float,guid,stringwere missing, withinteger,boolandvector) andfloatin its value union.ImportError.rvt/__init__.pycaught it and surfacedmodule 'rvt' has no attribute 'RevitFile'; the layout it fell back to is not onepyproject.tomlbuilds.UnreadStream'sDisplay), sorvt-ifc,rvt-gltf,rvt-rs-mcp, the diagnostics' warnings and Python all print it as{:?}: a stream named with a newline cannot forge a log line.No export moves.
Motivation
#1884. Registered rows: comment 6850068534.
Changes
rvt-py/src/lib.rs(1, 2),python/rvt/__init__.pyand__init__.pyi(3, 4),src/reader.rs(5, withtests/resource_limits_cli.rsanddocs/user-guide.mdfollowing the quoted name),docs/python.md(the warning, a "Threads" section),changelog.d/fixed/1884-python-bindings.md.tests/python/test_package_import.py(a stand-in for the extension that is missing, raisesImportError, or loads) andtests/python/test_gil_released.py(a thread that ticks each millisecond must wait less than a quarter of an export's time; Core Interior, skipped where it is absent).Testing
Unit tests are banned in this repository; the checks are end to end, on the installed wheel:
ab93cc57against8accf4f6) leaves all 146 export hashes and all 121diagnostics.jsonequal tomain's: the quoted stream name moves no diagnostics of any Measure model (none has an unread stream), and no scorer output moves.same-project gatescheck run onab93cc57issuccess(15 samples held to their earlier saves, and the Areas on 4 saves and on the 2021 save). The commit after it changes documents only.test_package_import.pyandtest_gil_released.pyon the wheel it builds. I cannot build locally (rule of this repository), so CI is the first compile of this change, includingpy.detach'sUngilbounds.tests/resource_limits_cli.rspasses with the quoted name (CI).Not measured: the warning for a partial saved mesh on a real file (no sample in the corpus decodes in part); the GIL release of
decoded_elements,element_countsandschedule_csv(the test coverswrite_ifcandexport_diagnostics_json: a call that returns many dicts holds the GIL to build them).Audit-honesty checklist
changelog.d/docs/python.md, the stub)Legal and contribution hygiene
Breaking changes
A handle shared between threads. A program that called one
RevitFilefrom two threads used to have the second call wait for the GIL; it now getsRuntimeErrorwhile the first runs. It needs a handle for each thread, or a lock (docs/python.md, "Threads"; the fragment says so).The text of the unread-stream sentence now quotes the stream's name (
stream "Partitions/189" (...)), in the CLIs, the diagnostics' warnings, the MCP server and Python. A script that matches the old text needs the quotes.Related issues
Closes #1884.