Skip to content

python: a partial saved mesh raises no RuntimeWarning, exports hold the GIL, and the stub forbids kinds the binding returns #1884

Closed

Description

@DrunkOnJava

Batch 5's audit of the Python surface (main at e57db42), each finding confirmed by a second reader. The docs row that still called a work-budget stop a ValueError is fixed in #1880.

  1. A partial saved mesh warns nowhere. When an element's saved graphics decode only in part, the export keeps its box and counts it (saved_meshes.rs:634, export_pipeline.rs:703-709), but no RuntimeWarning is raised, though docs/python.md:436-437, __init__.pyi:355-356 and rvt-py/src/lib.rs:146-149 all promise one. Fix: warn from ExportNote::SavedMeshes { partial > 0 } the way work-budget stops warn.
  2. Every export runs with the GIL held. There is no py.allow_threads in rvt-py/src/lib.rs: write_ifc (:208-263), rvt_to_ifc (:1139-1151), schedule_csv, export_diagnostics_json, decoded_elements and element_counts block every other Python thread for the whole decode. Fix: release the GIL around the Rust work, after checking what the handle shares across threads.
  3. The stub forbids kinds the binding returns. python/rvt/__init__.pyi:34's TypedField union lists four kinds; the emitter also returns float, guid and string. A type-checked consumer is told those cannot happen.
  4. A broken extension surfaces as a missing attribute. python/rvt/__init__.py:25 catches ImportError and passes, so a failed load of _rvt (a missing symbol, a wrong ABI) becomes AttributeError: module 'rvt' has no attribute 'RevitFile'. The comment there describes a layout pyproject.toml no longer builds. Fix: re-raise unless the module really is the flat layout.
  5. A stream name from the file is interpolated bare into an error message (lib.rs:245), so a name with a newline or control characters forges lines in a log; the phase error quotes its input with {:?} (reader.rs:1503). Fix: quote it the same way.

No export moves.

Activity

  1. added
    area:python
    priority:P2
    type:bug
    on Nov 13, 2026
  2. DrunkOnJava commented on Nov 13, 2026

    @DrunkOnJava
    OwnerAuthor

    Rows for the change (PR to follow, branch fix/1884-python-bindings at ab93cc57), registered before the run that reads them. The change: export_run warns on ExportNote::SavedMeshes { partial > 0 }; the decode, the STEP writer, the diagnostics serialisation and opening a file release the GIL; the stub lists the eleven field kinds and float; rvt/__init__.py no longer catches the extension's ImportError; and the unread-stream sentence quotes the name in one place, UnreadStream's Display (src/reader.rs), which rvt-ifc, rvt-gltf, rvt-rs-mcp, the diagnostics' warnings and Python all print.

    1. No export moves: all 146 export hashes of an unfiltered run (samples nordic r2025 racadv holdout bimcollab families) equal main's.
    2. diagnostics.json equal to main's on all 121, except a file that has an unread stream, whose Not read whole: warning now quotes the name; I expect none in Measure's models, none of which meets a default stream limit. If one differs, the only text that differs is the quotes.
    3. The same-project gates check run passes (the change touches src/).
    4. CI's Python job passes tests/python/test_package_import.py (a stand-in extension that is missing, raises ImportError, or loads) and, where Core Interior is present, tests/python/test_gil_released.py (a thread that ticks each millisecond waits less than a quarter of an export's time, for write_ifc and export_diagnostics_json).

    Not measured by any row: the RuntimeWarning for a partial saved mesh on a real file (no sample in the corpus decodes in part; the code path is the same as the other notes').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pythonpriority:P2type:bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions