Skip to content

Commit

Permalink
Extend bad-dunder-method-name to permit __index__ (#8300)
Browse files Browse the repository at this point in the history
## Summary

Fixes #8282

## Test Plan

`cargo test`
  • Loading branch information
burgholzer authored Oct 28, 2023
1 parent 3af890f commit 81a2e74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def __attrs_init__(self):
def __html__(self):
pass

# Allow Python's __index__
def __index__(self):
pass

# Allow _missing_, used by enum.Enum.
@classmethod
def _missing_(cls, value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ fn is_known_dunder_method(method: &str) -> bool {
| "__imatmul__"
| "__imod__"
| "__imul__"
| "__index__"
| "__init__"
| "__init_subclass__"
| "__instancecheck__"
Expand Down

0 comments on commit 81a2e74

Please sign in to comment.