From 8842c5ffa888aab2e4961fc54db45e7f3ca32ad9 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 13 Aug 2020 11:14:34 -0700 Subject: [PATCH] in verbose mode, print stack trace (#1594) Make Black failures easier to debug --- src/black/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index 803c7a1..349da1e 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -664,6 +664,8 @@ def reformat_one( write_cache(cache, [src], mode) report.done(src, changed) except Exception as exc: + if report.verbose: + traceback.print_exc() report.failed(src, str(exc)) @@ -3327,7 +3329,7 @@ class StringParenStripper(StringTransformer): new_line.append(string_leaf) append_leaves( - new_line, line, LL[string_idx + 1 : rpar_idx] + LL[rpar_idx + 1 :], + new_line, line, LL[string_idx + 1 : rpar_idx] + LL[rpar_idx + 1 :] ) LL[rpar_idx].remove() -- 2.39.2