diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-15 21:43:19 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-15 21:53:31 +0100 |
| commit | 639ca60a464a0e0454c5d291ee71b9b3d8de7d8f (patch) | |
| tree | 659d96f7c0a2e9c515fbe0bc65b41316a864abbf /kconfiglib.py | |
| parent | dc7fd40647f6b824d032a07d174402ad315214e2 (diff) | |
Simplify _decoding_error() a bit
Also add quotes around the filename.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index f3c51b1..30b7507 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -5903,18 +5903,15 @@ def _decoding_error(e, filename, macro_linenr=None): # macro_linenr holds the line number where it was run (the exact line # number isn't available for decoding errors in files). - if macro_linenr is None: - loc = filename - else: - loc = "output from macro at {}:{}".format(filename, macro_linenr) - raise KconfigError( "\n" "Malformed {} in {}\n" "Context: {}\n" "Problematic data: {}\n" "Reason: {}".format( - e.encoding, loc, + e.encoding, + "'{}'".format(filename) if macro_linenr is None else + "output from macro at {}:{}".format(filename, macro_linenr), e.object[max(e.start - 40, 0):e.end + 40], e.object[e.start:e.end], e.reason)) |
