From 6e45e09c176938b96ff2041e49731eb61bfcee54 Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Mon, 19 Oct 2020 12:23:25 -0700 Subject: [PATCH] Fix overly verbose `FieldSet` in stack traces (#10978) Closes https://github.com/pantsbuild/pants/issues/10971. [ci skip-rust] --- src/python/pants/engine/target.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python/pants/engine/target.py b/src/python/pants/engine/target.py index 9f002854d57..4fe6c0bccbf 100644 --- a/src/python/pants/engine/target.py +++ b/src/python/pants/engine/target.py @@ -803,6 +803,11 @@ def applicable_target_types( def debug_hint(self) -> str: return self.address.spec + def __repr__(self) -> str: + # We use a short repr() because this often shows up in stack traces. We don't need any of + # the field information because we can ask a user to send us their BUILD file. + return f"{self.__class__.__name__}(address={self.address})" + def _get_field_set_fields_from_target( field_set: Type[_AbstractFieldSet], target: Target