Whole file
erezsh/runtype
The author described this change as “Fix: Constraint type now works with casting”. It counts as a record because the check below fails on the code as it stood at 93fda03b9 and passes on 419041e99, with nothing else changed between the two runs.
Projecterezsh/runtype
Fix saved2021-09-24
Sharing licenceMIT · LICENSE
Change size+5 −0
What the code was meant to do, written into the code itself as a save note
Fix: Constraint type now works with casting
The change
| 52 | 52 | if not p(inst): | |
| 53 | 53 | raise TypeMismatchError(inst, self) | |
| 54 | 54 | ||
| 55 | + | def __ge__(self, other): | |
| 56 | + | return self.type >= other | |
| 57 | + | def __le__(self, other): | |
| 58 | + | return self.type <= other | |
| 59 | + | ||
| 55 | 60 | ||
| 56 | 61 | ||
| 57 | 62 | class AnyType(AnyType, PythonType): |
The check that tells the two apart
fail→pass·tests/test_basic.py::TestDataclass::test_typing
Check file tests/test_basic.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it93fda03b9f1e8420e5f5356662619d540f423685
Broken version dated2021-09-23
Moduleruntype.pytypes
Units changedConstraint
Fingerprintc18f8273f6540e99
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.