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

Qiskit / qiskit / 14202845288
89%
main: 88%

Build:
Build:
LAST BUILD BRANCH: contract_idle_wires_fail_on_break_loop_fix
DEFAULT BRANCH: main
Ran 01 Apr 2025 06:30PM UTC
Jobs 1
Files 916
Run time 3min
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

01 Apr 2025 06:06PM UTC coverage: 88.802% (+0.01%) from 88.789%
14202845288

push

github

web-flow
Fix handling of custom gates named unitary in Split2qUnitaries (#14108)

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, if you then qpy serialize
the circuit that contains a custom `_DefinedGate` instance that's named
"unitary", QPY doesn't understand what `_DefinedGate` is and assumes that
it can not fully recreate it because it's outside the standard Qiskit data
model. In these cases qpy serializes the fields from the standard data
model defined in Qiskit which it knows about: name, params, definition, etc
and encodes that as a custom gate. When deserializing that custom gate it
populates the standard fields, but anything defined outside of that is
lost through the serialization because it's defined outside of Qiskit.
This means the custom `__array__` implementation is missing from the
qpy round-tripped, previously qasm2 round-tripped, `UnitaryGate`
insta... (continued)

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

5 existing lines in 2 files now uncovered.

79448 of 89466 relevant lines covered (88.8%)

354695.81 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
94.02
-0.24% crates/qasm2/src/expr.rs
4
92.73
0.25% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 14202845288.1 01 Apr 2025 06:30PM UTC 916
88.8
GitHub Action Run
Source Files on build 14202845288
  • Tree
  • List 916
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14202845288
  • 5d780703 on github
  • Prev Build on stable/1.4 (#14200061146)
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

© 2026 Coveralls, Inc