One function
source_analysis in roskakori/pygount
The author described this change as “#4: Fixed ``LookupError`` on broken encoding in magic comment.”. It counts as a record because the check below fails on the code as it stood at 896893b29 and passes on a0bc17521, with nothing else changed between the two runs.
Projectroskakori/pygount
Fix saved2016-09-11
Sharing licenceBSD-3-Clause · LICENSE.txt
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
Analysis for line counts in source code stored in `source_path`. :param source_path: :param group: name of a logical group the sourc code belongs to, e.g. a package. :param encoding: encoding according to :func:`encoding_for` :param fallback_encoding: fallback encoding according to :func:`encoding_for` :return: a :class:`SourceAnalysis`; if no matching lexer could be found, `language` is `None``.
The change
| 26 | 26 | try: | |
| 27 | 27 | with open(source_path, 'r', encoding=encoding) as source_file: | |
| 28 | 28 | text = source_file.read() | |
| 29 | - | except (OSError, UnicodeDecodeError) as error: | |
| 29 | + | except (LookupError, OSError, UnicodeDecodeError) as error: | |
| 30 | 30 | _log.warning('cannot read %s: %s', source_path, error) | |
| 31 | 31 | result = SourceAnalysis(source_path, 'error', group, 0, 0, 0, 0) | |
| 32 | 32 | if result is None: |
The check that tells the two apart
fail→pass·tests/test_analysis.py::AnalysisTest::test_fails_on_unknown_magic_encoding_comment
Check file tests/test_analysis.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 it896893b29b404ad396291dc3db3debbc68422b9c
Broken version dated2016-09-11
Modulepygount.analysis
Units changedsource_analysis
Fingerprintd5dfb79afdbdb483
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.