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

Qiskit / qiskit / 14203546672
89%
main: 88%

Build:
Build:
LAST BUILD BRANCH: gh-readonly-queue/main/pr-15586-0b8bceb075d9aa72ba17346ce627ab26aaceb1d0
DEFAULT BRANCH: main
Ran 01 Apr 2025 07:07PM UTC
Jobs 1
Files 916
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

01 Apr 2025 06:06PM UTC coverage: 88.813% (+0.02%) from 88.789%
14203546672

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%)

7 existing lines in 3 files now uncovered.

79457 of 89466 relevant lines covered (88.81%)

358349.15 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
91.96
-0.06% crates/accelerate/src/two_qubit_decompose.rs
1
93.21
0.0% crates/accelerate/src/unitary_synthesis.rs
5
91.98
-0.5% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 14203546672.1 01 Apr 2025 07:07PM UTC 916
88.81
GitHub Action Run
Source Files on build 14203546672
  • Tree
  • List 916
  • Changed 5
  • Source Changed 1
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14203546672
  • 5d780703 on github
  • Prev Build on stable/1.4 (#14200061146)
  • Next Build on stable/1.4 (#14246930165)
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