Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arbitrary iterables in assign_parameters #12887

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

jakelishman
Copy link
Member

Summary

In Qiskit 1.1, it was possible to give any object that was iterable and had a __len__ as the binding sequence for assign_parameters. The move to Rust space inadvertantly limited that to things that fulfilled the sequence API. This commit restores the ability to use general iterables, and removes the need to have a __len__.

Details and comments

Fix #12885, but no release note because the bug isn't in a final release.

In Qiskit 1.1, it was possible to give any object that was iterable and
had a `__len__` as the binding sequence for `assign_parameters`.  The
move to Rust space inadvertantly limited that to things that fulfilled
the sequence API.  This commit restores the ability to use general
iterables, and removes the need to have a `__len__`.
@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: None Do not include in changelog labels Aug 2, 2024
@jakelishman jakelishman added this to the 1.2.0 milestone Aug 2, 2024
@jakelishman jakelishman requested a review from a team as a code owner August 2, 2024 09:05
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core
  • @kevinhartman
  • @mtreinish

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10212978644

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 13 of 21 (61.9%) changed or added relevant lines in 2 files are covered.
  • 18 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.02%) to 89.734%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/circuit/src/circuit_data.rs 12 20 60.0%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.39%
crates/qasm2/src/lex.rs 4 92.98%
crates/qasm2/src/parse.rs 6 96.69%
qiskit/synthesis/two_qubit/xx_decompose/decomposer.py 6 90.84%
Totals Coverage Status
Change from base Build 10201486203: -0.02%
Covered Lines: 67343
Relevant Lines: 75047

💛 - Coveralls

@Cryoris Cryoris added this pull request to the merge queue Aug 2, 2024
Merged via the queue into Qiskit:main with commit 9de8119 Aug 2, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request Aug 2, 2024
In Qiskit 1.1, it was possible to give any object that was iterable and
had a `__len__` as the binding sequence for `assign_parameters`.  The
move to Rust space inadvertantly limited that to things that fulfilled
the sequence API.  This commit restores the ability to use general
iterables, and removes the need to have a `__len__`.

(cherry picked from commit 9de8119)
@jakelishman jakelishman deleted the assign-parameters-iterable branch August 2, 2024 14:39
github-merge-queue bot pushed a commit that referenced this pull request Aug 2, 2024
In Qiskit 1.1, it was possible to give any object that was iterable and
had a `__len__` as the binding sequence for `assign_parameters`.  The
move to Rust space inadvertantly limited that to things that fulfilled
the sequence API.  This commit restores the ability to use general
iterables, and removes the need to have a `__len__`.

(cherry picked from commit 9de8119)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
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 changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QuantumCircuit.assign_parameters of Qiskit 1.2.0 rc1 raises an error with dict_values while Qiskit 1.1 works
4 participants