Python utility library
- Python 98.5%
- Makefile 1.3%
- Shell 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
The by_index branch of Options.get() raises KeyError for every integer index, because the first isinstance guard is inverted: it fires for exactly the keys the branch is supposed to handle, so the range check and the lookup in the list of parsed keys below it are dead code. A non-integer key with by_index set slips past the guard and falls through to the regular key lookup instead. A previous make-check fallout commit flipped the original type(key) != int test into a positive isinstance test, and a later mypy fix then added redundant isinstance guards to the unreachable branches, cementing the broken flow. Invert the guard back to not isinstance(key, int), so that a non-integer key raises KeyError, an in-range integer index returns the key stored at that position in the option string, and an out-of-range index returns the default or raises KeyError. Drop the redundant isinstance guards from the now-reachable branches. TODO: The bug actually made "make -C test/parse_opts run" fail, but since jw-python's nightly CI doesn't run that, this has gone unnoticed. The test now passes, but should be replaced with a better test (executed by "make test", and pytest-based). Signed-off-by: Jan Lindemann <jan@janware.com> |
||
| .github/workflows | ||
| bin | ||
| conf | ||
| make | ||
| scripts | ||
| src | ||
| test | ||
| .gitignore | ||
| HASH | ||
| Makefile | ||
| RELEASES | ||
| VERSION | ||