• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 14109208575
88%

Build:
DEFAULT BRANCH: main
Ran 27 Mar 2025 03:11PM UTC
Jobs 1
Files 788
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Mar 2025 01:13PM UTC coverage: 88.091% (+0.01%) from 88.081%
14109208575

push

github

web-flow
Correctly handle non-UnitaryGate gates named "unitary" (#14109)

Normally creating a custom gate class that overloads the name of a
Qiskit defined operation is not valid and not allowed. The names have
meaning and are often used as identifiers and this overloading the name
will prevent Qiskit from correctly identifying an operation. However as
was discovered in #14103 there are some paths available around
serialization and I/O where Qiskit does this itself. For example, qasm
(both 2 and 3) is a lossy serialization format and qasm2 doesn't have a
representation of a UnitaryGate. So when the qasm2 exporter encounteres
a `UnitaryGate` it is serialized as a custom gate definition with the
name "unitary" in the output qasm2 and the definition is a decomposition
of the unitary from the `UnitaryGate`. When that qasm2 program is
subsequently deserialized by qiskit parser the custom gate named "unitary"
is added as a `_DefinedGate` subclass which includes an `__array__`
implementation which computes the unitary from the definition using
the quantum info Operator class. This makes the custom gate parsed from
qasm2 look like a `UnitaryGate` despite not actually one so this is
typically fine for most use cases. However, since #13759 trying to add
that not `UnitaryGate` object named "unitary" would cause the Python ->
Rust translation to panic (which happens as part of qasm2
desierailzation). because the conversion was expecting a gate named
`unitary` to be a `UnitaryGate` as is prescribed by the data model.

This commit fixes this by gracefully handling the lack of a matrix
parameter as it not actually being a `UnitaryGate` and instead the
object gets treated as a `PyGate` in rust which is the expected
behavior.

Related to #14103

1 of 1 new or added line in 1 file covered. (100.0%)

6 existing lines in 3 files now uncovered.

72758 of 82594 relevant lines covered (88.09%)

365310.67 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
94.79
0.0% crates/accelerate/src/unitary_synthesis.rs
1
94.23
-0.23% crates/qasm2/src/expr.rs
4
92.23
0.5% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 14109208575.1 27 Mar 2025 03:11PM UTC 788
88.09
GitHub Action Run
Source Files on build 14109208575
  • Tree
  • List 788
  • Changed 5
  • Source Changed 1
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14109208575
  • ddb80250 on github
  • Prev Build on gh-readonly-queue/main/pr-14104-bfa2331aff7e0ada1756fc8f434d49304770b83e (#14107657248)
  • Next Build on main (#14125229820)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc