| 423 | |
| 424 | |
| 425 | class HaskKeyCrasher: |
| 426 | def __init__(self, *, error_on_hash=False, error_on_eq=False): |
| 427 | self.error_on_hash = error_on_hash |
| 428 | self.error_on_eq = error_on_eq |
| 429 | |
| 430 | def __enter__(self): |
| 431 | if HashKey._crasher is not None: |
| 432 | raise RuntimeError('cannot nest crashers') |
| 433 | HashKey._crasher = self |
| 434 | |
| 435 | def __exit__(self, *exc): |
| 436 | HashKey._crasher = None |
| 437 | |
| 438 | |
| 439 | class HashingError(Exception): |
no outgoing calls