quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Demonstration of bad hashing #6680

Closed dstrain115 closed 2 months ago

dstrain115 commented 2 months ago

This example shows that the test for this is broken, as, when unpickling, the act of unpickling actually corrupts the cache. Both the unpickled Qid and original Qid have the same hash, but it is the BAD HASH!!!!

This can be demonstrated by comparing the hash to the previous hash saved before pickling.

I am not quite sure how to fix it. Maybe use __getstate__ and __setstate__ instead