-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Comb] Update Python binding decorators to wrap in the right order. (#…
…6377) With a recent change upstream to the new `register_operation` decorators, we accidentally broke the Python class hierarchy for comb ops. Before this change, we would wrap the class generated by `register_operation`. This meant the added `create` methods were present on those classes, but when an operation was returned via Python bindings methods, it would not be a subclass of our final wrapped class; it would be the class returned by `register_operation`, and `isinstance` would not work as expected. With this change, we first wrap the class with our decorator, then wrap it with `register_operation`. This way, when operations are returned from the Python bindings, the returned operation is a subclass of our final wrapped class, and `isinstance` works as expected. A somewhat hacky but thorough test is added that demonstrates this issue, and confirms the new decorator order is working as expected.
- Loading branch information
1 parent
903b876
commit c823db7
Showing
2 changed files
with
32 additions
and
16 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