Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 31, 2025

Following on the changes in #13793, I think we should also stop trying to serialize into a dictionary since the header should already be a dictionary.

Currently we face the following issue when doing result.to_dict()

  File "/opt/app-root/lib64/python3.11/site-packages/qiskit/result/result.py", line 91, in to_dict
    "header": None if self.header is None else self.header.to_dict(),
                                               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'to_dict'

Added corresponding regression test based on existing to_repr test


This is an automatic backport of pull request #14124 done by Mergify.

* fix result.to_dict() following new 2.0 typing

* Update qiskit/result/result.py

Co-authored-by: Luciano Bello <766693+1ucian0@users.noreply.github.com>

* add result to_dict test

* add release note

* Update type hints to reflect current use of Result. We no longer have any ExperimentHeader class to call  on, so the type can only be dict.

* Remove reno, as the bug is technically unreleased

---------

Co-authored-by: valente <valente@ar.ibm.com>
Co-authored-by: Luciano Bello <766693+1ucian0@users.noreply.github.com>
Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
(cherry picked from commit 00c4756)
@mergify mergify bot requested a review from a team as a code owner March 31, 2025 12:19
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

@github-actions github-actions bot added Changelog: None Do not include in changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo labels Mar 31, 2025
@github-actions github-actions bot added this to the 2.0.0 milestone Mar 31, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14171371221

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 88.136%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 92.98%
Totals Coverage Status
Change from base Build 14139800024: 0.02%
Covered Lines: 72811
Relevant Lines: 82612

💛 - Coveralls

@ElePT ElePT enabled auto-merge March 31, 2025 12:46
@ElePT ElePT added this pull request to the merge queue Mar 31, 2025
Merged via the queue into stable/2.0 with commit 292546f Mar 31, 2025
23 checks passed
@jakelishman jakelishman deleted the mergify/bp/stable/2.0/pr-14124 branch June 9, 2025 15:41
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 Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants