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

Qiskit / qiskit / 16121459629
88%
main: 88%

Build:
Build:
LAST BUILD BRANCH: substitute_pi4_rotations
DEFAULT BRANCH: main
Ran 07 Jul 2025 04:08PM UTC
Jobs 1
Files 829
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

07 Jul 2025 03:38PM UTC coverage: 87.764% (-0.04%) from 87.807%
16121459629

push

github

web-flow
Avoid py token usage in the common path for circuit_to_dag (#14589)

* Avoid py token usage in the common path for circuit_to_data

This commit adjusts the Python usage in the
DAGCircuit::from_circuit_data code paths. Most of the data model is in
Rust at this point with the exception of things explicitly defined in
Python (ie a custom gate in Python), ParameterExpression, and control
flow. While the latter two are in progress (see #13267 and #13271) we
don't need to block the development of C API features that depend on
circuit->dag conversion. The Python usage in this code path is around
parameterized global phase and deepcopying custom python gates.
Neither of these are possible from C because they're in Python and not
exposed to C. This commit removes the py token from the function
signatures and actively acquires the gil inline if we're using Python
parts of the data model when they're needed.

* Move deepcopy Python usage up to Python defined types

In the previous commit the py token acquisition was moved down into the
PackedInstruction::py_deepcopy() method instead of being the
responsibility of the caller. This decision was made because we only
need the py token in a context where objects defined in Python are
encountered. The goal of hiding the py token is that in a context
without python at all (i.e. the standalone C API) nothing callable from
a pure rust context requires the py token. The token was moved down so
that we only ever try to acquire the GIL in contexts where we have a
python defined object. The method only ever uses it to deep copy in the
case of PackedInstruction containing a Python defined object.

In code review the concern was raised that deepcopy is a purely python
construct and the `py_deepcopy` should very explicitly be the caller's
responsibility to assert they have the GIL by passing the py token. To
address this concern but also enable a Python free path through circuit
to dag conversion this commit moves the `deepcopy... (continued)

105 of 128 new or added lines in 11 files covered. (82.03%)

25 existing lines in 3 files now uncovered.

81048 of 92348 relevant lines covered (87.76%)

503807.5 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
8
86.11
-1.16% crates/transpiler/src/passes/basis_translator/mod.rs
15
69.7
-2.86% crates/circuit/src/dag_node.rs

Uncovered Existing Lines

Lines Coverage ∆ File
6
73.73
-0.21% crates/circuit/src/symbol_expr.rs
7
91.75
-1.29% crates/qasm2/src/lex.rs
12
97.09
-0.94% crates/qasm2/src/parse.rs
Jobs
ID Job ID Ran Files Coverage
1 16121459629.1 07 Jul 2025 04:08PM UTC 829
87.76
GitHub Action Run
Source Files on build 16121459629
  • Tree
  • List 829
  • Changed 16
  • Source Changed 13
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #16121459629
  • 8cbb31d8 on github
  • Prev Build on gh-readonly-queue/main/pr-14689-9b5cdedf3229d7a0fe1382cb8f1db2d563dd0626 (#16120131425)
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