Skip to content

Mark ProjectorSum class as unhashable#6701

Merged
pavoljuhas merged 1 commit into
quantumlib:mainfrom
pavoljuhas:mark-ProjectorSum-unhashable
Aug 8, 2024
Merged

Mark ProjectorSum class as unhashable#6701
pavoljuhas merged 1 commit into
quantumlib:mainfrom
pavoljuhas:mark-ProjectorSum-unhashable

Conversation

@pavoljuhas

Copy link
Copy Markdown
Collaborator

ProjectorSum stores data in a mutable LinearDict which is not hashable.
LinearDict also does not pickle, because by default it has a
lambda-function attribute.

This excludes ProjectorSum from the test_hash_from_pickle test.

Resolves #6674

ProjectorSum stores data in a mutable LinearDict which is not hashable.
LinearDict also does not pickle, because by default it has a
lambda-function attribute.

This excludes ProjectorSum from the `test_hash_from_pickle` test.

Resolves quantumlib#6674
@pavoljuhas pavoljuhas requested review from a team and vtomole as code owners August 8, 2024 01:02
@CirqBot CirqBot added the Size: XS <10 lines changed label Aug 8, 2024
@codecov

codecov Bot commented Aug 8, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.83%. Comparing base (5377fff) to head (00d4344).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6701   +/-   ##
=======================================
  Coverage   97.82%   97.83%           
=======================================
  Files        1075     1075           
  Lines       92325    92325           
=======================================
+ Hits        90320    90324    +4     
+ Misses       2005     2001    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pavoljuhas pavoljuhas merged commit e2e8aef into quantumlib:main Aug 8, 2024
@pavoljuhas pavoljuhas deleted the mark-ProjectorSum-unhashable branch August 8, 2024 23:53
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
ProjectorSum stores data in a mutable LinearDict which is not hashable.
LinearDict also does not pickle, because by default it has a
lambda-function attribute.

This excludes ProjectorSum from the `test_hash_from_pickle` test.

Resolves quantumlib#6674
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
ProjectorSum stores data in a mutable LinearDict which is not hashable.
LinearDict also does not pickle, because by default it has a
lambda-function attribute.

This excludes ProjectorSum from the `test_hash_from_pickle` test.

Resolves quantumlib#6674
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: XS <10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid pickling of cached values of cached_method decorated functions

3 participants