Skip to content

Use generic errors in the variable mapper and expr.#16132

Open
raynelfss wants to merge 1 commit intoQiskit:mainfrom
raynelfss:variable-mapper-generic
Open

Use generic errors in the variable mapper and expr.#16132
raynelfss wants to merge 1 commit intoQiskit:mainfrom
raynelfss:variable-mapper-generic

Conversation

@raynelfss
Copy link
Copy Markdown
Contributor

While in the past we relied on PyResult to handle all of the errors as python exceptions, we can now remove some of the dependencies in parts of our system. After some evaluation, it turns out we can use generic errors in the VariableMapper and Expr which frees us from needing python in order to use these components.

This was discovered during efforts to separate DAGCircuit's error messages from always using PyErr.

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:

While in the past we relied on `PyResult` to handle all of the errors as python exceptions, we can now remove some of the dependencies in parts of our system.
After some evaluation, it turns out we can use generic errors in the `VariableMapper` and `Expr` which frees us from needing python in order to use these components.

This was discovered during efforts to separate `DAGCircuit`'s error messages from always using `PyErr`.
@raynelfss raynelfss added this to the 2.5.0 milestone May 4, 2026
@raynelfss raynelfss requested a review from a team as a code owner May 4, 2026 19:29
@raynelfss raynelfss requested a review from ShellyGarion May 4, 2026 19:29
@raynelfss raynelfss added Changelog: None Do not include in the GitHub Release changelog. Rust This PR or issue is related to Rust code in the repository mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels May 4, 2026
@github-project-automation github-project-automation Bot moved this to Ready in Qiskit 2.5 May 4, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 25338938321

Coverage increased (+0.01%) to 87.568%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (24 of 25 lines covered, 96.0%).
  • 2 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
crates/circuit/src/variable_mapper.rs 17 16 94.12%

Coverage Regressions

2 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
crates/qasm2/src/expr.rs 1 93.82%
crates/qasm2/src/lex.rs 1 92.03%

Coverage Stats

Coverage Status
Relevant Lines: 121808
Covered Lines: 106665
Line Coverage: 87.57%
Coverage Strength: 965110.25 hits per line

💛 - Coveralls

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

Labels

Changelog: None Do not include in the GitHub Release changelog. mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library Rust This PR or issue is related to Rust code in the repository

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

3 participants