Commit dfbfbaa
committed
Fix Version.__hash__ to be consistent with __eq__.
Two bugs:
1. __hash__ uses _unparsed (raw string) but __eq__ uses _parsed, so "1" ==
"1.0" but hash differs.
2. _normalize doesn't recurse into sublists, so _parsed isn't fully canonical:
"1-2-0" gets (1,(2,())) instead of (1,(2,)).
Fix _normalize to recurse into sublists first, making _parsed canonical, then
use hash(_parsed) for __hash__.
Fixes #189
Signed-off-by: Matt Selsky <matthew.selsky@twosigma.com>1 parent 92b1a24 commit dfbfbaa
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
| 422 | + | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
495 | 498 | | |
496 | 499 | | |
497 | 500 | | |
| |||
0 commit comments