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

Fixed bug in deepcopy of IBMBackend #902

Merged
merged 12 commits into from
Jul 6, 2023
Merged

Conversation

merav-aharoni
Copy link
Contributor

Summary

Fixed infinite recursion when attempting to deepcopy an IBMBackend.

Details and comments

Fixes #899.
See also Qiskit/qiskit-ibm-provider#658.

@coveralls
Copy link

coveralls commented Jun 11, 2023

Pull Request Test Coverage Report for Build 5476169550

  • 2 of 15 (13.33%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 72.58%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/ibm_backend.py 2 15 13.33%
Totals Coverage Status
Change from base Build 5470974000: -0.2%
Covered Lines: 2594
Relevant Lines: 3574

💛 - Coveralls

@merav-aharoni merav-aharoni marked this pull request as ready for review June 11, 2023 13:21
@merav-aharoni merav-aharoni requested a review from kt474 June 11, 2023 13:21
@merav-aharoni
Copy link
Contributor Author

When using the default deepcopy, we got a bug because IBMBackend contains a QiskitRuntimeService, and that contains a list of all the supported backends. So if the list of backends was already loaded in the method QiskitRuntimeService.backends(), we got an infinite recursion bug.
In a conversation with @jyu00 and @kt474 , we decided to implement a deepcopy method for IBMBackend, to avoid this problem. In this implementation, the list of backends in IBMBackend._service._backends is copied and not deepcopied.

@merav-aharoni
Copy link
Contributor Author

@kt474 - can you review again?

Copy link
Member

@kt474 kt474 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kt474 kt474 merged commit e6d48bc into Qiskit:main Jul 6, 2023
17 checks passed
@merav-aharoni merav-aharoni deleted the deepcopy_bug branch August 13, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to deepcopy an IBMBackend
3 participants