One function
Arg in NiklasRosenstein/python-nr.util
The author described this change as “fix: fix instantiation of `Safe` and `Unsafe`”. It counts as a record because the checks below fail on the code as it stood at 734d42e65 and pass on 449d7cbe5, with nothing else changed between the two runs.
Fix saved2022-01-10
Sharing licenceMIT · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
Base class for arguments. Cannot be directly constructed.
The change
| 2 | 2 | """ Base class for arguments. Cannot be directly constructed. """ | |
| 3 | 3 | ||
| 4 | 4 | def __init__(self, value: T) -> None: | |
| 5 | - | if type(self) is not (Safe, Unsafe): | |
| 5 | + | if type(self) not in (Safe, Unsafe): | |
| 6 | 6 | raise RuntimeError(f'cannot create object of type {type(self).__name__}') | |
| 7 | 7 | self._value = value | |
| 8 | 8 |
The check that tells the two apart
fail→pass·src/nr/util/safearg/__test.py::test_create_safe
fail→pass·src/nr/util/safearg/__test.py::test_create_unsafe
Check file src/nr/util/safearg/__test.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 it734d42e65d40d141851a06366d98c30930825b07
Broken version dated2022-01-10
Modulenr.util.safearg.__init__
Units changedArg
Fingerprint1cd191ada04c1198
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.