-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cyclic-definition handling from
Clifford.from_circuit
(#10441)
* Remove cyclic-definition handling from `Clifford.from_circuit` This reliance on `RecursionError` could lead to CPython crashing, when the user had raised the recursion limit beyond what their operating system could actually support in terms of Python frames. This was particularly an issue with Windows when in a context that `jedi` is active (such as in an IPython session, or if `seaborn` was imported), since `jedi` unilaterally sets the recursion limit to 3000, while CPython tends to overflow the stack on Windows at around 2700 frames. Recursive `definition` fields are not valid data in the Qiskit model, as the definition is supposed to be hierarchical, and a decomposition in terms of gates that do not involve the current one in any form. For defining equivalences that may involve cycles, one should use the `EquivalenceLibrary` objects that Terra manages, and the transpiler takes advantage of via the `BasisTranslator`. * Remove unused import
- Loading branch information
1 parent
b831bcf
commit 35f9e7c
Showing
3 changed files
with
18 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
upgrade: | ||
- | | ||
:meth:`.Clifford.from_circuit` will no longer attempt to resolve instructions whose | ||
:attr:`~.circuit.Instruction.definition` fields are mutually recursive with some other object. | ||
Such recursive definitions are already a violation of the strictly hierarchical ordering that | ||
the :attr:`~.circuit.Instruction.definition` field requires, and code should not rely on this | ||
being possible at all. If you want to define equivalences that are permitted to have (mutual) | ||
cycles, use an :class:`.EquivalenceLibrary`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters