Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Fix Parameter uuid on deserialization #771

Merged
merged 2 commits into from
Dec 1, 2023
Merged

Conversation

t-imamichi
Copy link
Member

Summary

When serializing a parameter, uuid data is included. But, the uuid is overwritten with a different value by calling Parameter.__init__ when deserializing it.
This PR fixes the issue.

Details and comments

import json
from qiskit_ibm_runtime import RuntimeEncoder, RuntimeDecoder
from qiskit.circuit import Parameter

param = Parameter('a')
print(param, param._uuid)
buf = json.dumps(param, cls=RuntimeEncoder)
param2 = json.loads(buf, cls=RuntimeDecoder)
print(param2, param2._uuid)

main branch

a 7d8797c6-2fd0-4e69-8af9-8f8dd946534f
a e000ea8d-5599-413a-8831-efc4939baa01

this PR

a 6b4c82a7-2f86-4b2a-b447-5fd42ae93a99
a 6b4c82a7-2f86-4b2a-b447-5fd42ae93a99

@t-imamichi t-imamichi changed the title Fix Parameter uuid on serialization Fix Parameter uuid on deserialization Nov 29, 2023
@coveralls
Copy link

coveralls commented Nov 29, 2023

Pull Request Test Coverage Report for Build 7051982783

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 51.88%

Totals Coverage Status
Change from base Build 7051925153: 0.2%
Covered Lines: 3422
Relevant Lines: 6596

💛 - Coveralls

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.

This is already done in #736 but that's currently blocked so we can merge this first

@t-imamichi
Copy link
Member Author

Thank you for your information. I didn't notice #736. If it will be merged soon, I'm fine to close this PR.

@kt474 kt474 merged commit 6be5f32 into Qiskit:main Dec 1, 2023
19 checks passed
@t-imamichi t-imamichi deleted the fix-param-uuid branch December 4, 2023 03:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants