Skip to content

Conversation

@pavoljuhas
Copy link
Collaborator

The Circuit.insert uses identity to determine the InsertStrategy kind.
Here we ensure that InsertStrategy.NAME is restored to the same object
after pickle-unpickle round trip. This should prevent unexpected
behavior if cirq.Insert is used in a multiprocessing call.

The `Circuit.insert` uses identity to determine the `InsertStrategy` kind.
Here we make InsertStrategy.NAME to get restored to the same object
after pickle-unpickle round trip.  This should prevent unexpected
behavior if `cirq.Insert` is used in a multiprocessing call.
@pavoljuhas pavoljuhas requested review from a team and vtomole as code owners March 11, 2025 23:11
@CirqBot CirqBot added the size: S 10< lines changed <50 label Mar 11, 2025
@pavoljuhas pavoljuhas requested a review from daxfohl March 11, 2025 23:17
@pavoljuhas pavoljuhas enabled auto-merge March 11, 2025 23:22
@codecov
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (b3af2ee) to head (4682b67).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7138      +/-   ##
==========================================
- Coverage   98.16%   98.15%   -0.01%     
==========================================
  Files        1093     1093              
  Lines       95523    95536      +13     
==========================================
+ Hits        93767    93777      +10     
- Misses       1756     1759       +3     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pavoljuhas pavoljuhas requested a review from mhucka March 12, 2025 19:27
@pavoljuhas pavoljuhas added this pull request to the merge queue Mar 12, 2025
Merged via the queue into quantumlib:main with commit 5d59cf7 Mar 12, 2025
39 checks passed
@pavoljuhas pavoljuhas deleted the pickle-insertstrategy-as-singleton branch March 12, 2025 23:17
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
…tumlib#7138)

The `Circuit.insert` uses identity to determine the `InsertStrategy` kind.
Here we make InsertStrategy.NAME to get restored to the same object
after pickle-unpickle round trip.  This should prevent unexpected
behavior if `cirq.Insert` is used in a multiprocessing call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants