-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix signature of CaptureMeta objects (#5727)
**Context:** In PR #5511 , we introduced the meta type `qml.capture.MetaOperator` that hijacked the class creation processes. The `__call__` signature for these classes got altered to the completely general `(cls, *args, **kwargs)` instead of the more specific version used by `__init__`. **Description of the Change:** Adds a `__signature__` property to `MetaOperator` that ensures that the signature will always be the `__init__` signature. **Benefits:** Signatures continue to match the `__init__` definition. **Possible Drawbacks:** The metaprogramming black magic may still have other consequences we still aren't aware of. This fixes the particular signature issue, but it still shows the consequences of metaprogramming. **Related GitHub Issues:** Fixes #5724 [sc-63734] <img width="487" alt="Screenshot 2024-05-22 at 9 42 10 AM" src="https://github.com/PennyLaneAI/pennylane/assets/6364575/1abf41ce-b72a-4734-a069-3dd37e7f8c28">
- Loading branch information
Showing
4 changed files
with
28 additions
and
6 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
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