From 346c0a613d03f2343e29c4fd7671f9c2c25b22e8 Mon Sep 17 00:00:00 2001 From: Pol Alvarez Date: Thu, 9 Jul 2026 17:00:56 +0200 Subject: [PATCH] fix: silence CST render errors in whereis() with graceful fallback --- remold/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/remold/__init__.py b/remold/__init__.py index f1ec09c..6542aae 100644 --- a/remold/__init__.py +++ b/remold/__init__.py @@ -120,7 +120,8 @@ def whereis( "For each fragment, the attribute paths where LibCST keeps it, deepest node first" mod = cst.parse_module(src) def _hit(n, frag): - c = _render(n).strip() + try: c = _render(n).strip() + except Exception: return False return frag in c if contains else c==frag return {frag: [p for p,n in sorted(((p,n) for p,n in _walk(mod) if p and _hit(n, frag)), key=lambda o: -len(o[0]))] for frag in frags}