Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repeated alerts by using type instead of instanceof #608

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Geth Traces depth reduced ([#562](https://github.com/iamdefinitelyahuman/brownie/pull/562))
- Ganache gasCost in traces (ganache bug) ([#562](https://github.com/iamdefinitelyahuman/brownie/pull/562))
- Decoding error when contracts use the same event signature with different argument indexing ([#575](https://github.com/iamdefinitelyahuman/brownie/pull/575))
- Repeated alerts will now run indefinitely, instead of twice

## [1.8.9](https://github.com/iamdefinitelyahuman/brownie/tree/v1.8.9) - 2020-05-26
### Changed
Expand Down
2 changes: 1 addition & 1 deletion brownie/network/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _loop(
start_value = value
if not repeat:
repeat = None
elif isinstance(repeat, int):
elif type(repeat) == int:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more verbose, but I think preferable to use isinstance(repeat, int) and not isinstance(repeat, bool) - because Wei is an int subclass and commonly used for return values, I can imagine a situation where the user is trying to set an alert with that type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Updated to reflect this.

I'll keep a lookout for possible improvements while we apply our usecase to it 👍

repeat -= 1
finally:
_instances.discard(self)
Expand Down