Skip to content

WIP: Fix #15580 - Explicitly build BlueprintCircuits in QPY dump#16048

Draft
debasmita2102 wants to merge 1 commit intoQiskit:mainfrom
debasmita2102:issue-15580-blueprint-lazy
Draft

WIP: Fix #15580 - Explicitly build BlueprintCircuits in QPY dump#16048
debasmita2102 wants to merge 1 commit intoQiskit:mainfrom
debasmita2102:issue-15580-blueprint-lazy

Conversation

@debasmita2102
Copy link
Copy Markdown
Contributor

@debasmita2102 debasmita2102 commented Apr 16, 2026

Fix Issue #15580 by adding a type-check for BlueprintCircuit in qiskit.qpy.interface.dump

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code:

Copy link
Copy Markdown
Member

@eliarbel eliarbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Debasmita for addressing this. This is still in draft mode but I have a couple of comments which I think would help. The original motivation for this was to make sure accessing the _data attribute from Rust is safe, without needing a prior call to data() on the Rust side (which is this line:

ob.getattr("data")?; // in case _data is lazily generated in python
). To this end:

  1. Your PR branch is old and doesn't even contain the Rust QPY in it, so you'll need to either rebase it over upstream/main (assuming your qiskit remote is called upstream) or open a new PR over the current main.
  2. We should call program._build() only if we're using the Rust circuit writer. So I would put the if isinstance(program, BlueprintCircuit) check here:
    if use_rust:
    if annotation_factories is None:

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants