Fix ValueError in __str__/repr and error messages with extreme values (#2971)

* Fix ValueError in __str__/repr and error messages with extreme values

Fix two related crashes:

1. When a node has a very long name (e.g., 58+ character identifier),
   the pprint width calculation `80 - len(field) - alignment` produces
   zero or negative values, causing `ValueError('width must be != 0')`.
   (Fixes #2764)

2. When a node contains a very large integer value (e.g., `7**10000`),
   `pprint.pformat()` and `str()` hit Python 3.11+'s integer-to-string
   conversion limit, raising `ValueError`. This affects both `__str__`
   and error message formatting in `getitem()`. (Fixes #2785)

Changes:
- All pprint width calculations now use `max(..., 1)`
- All pprint calls wrapped in try/except ValueError with fallback
- `Const.getitem()` error message guards against large value stringification

* Improve test coverage for ValueError guard paths

Add tests that exercise the except ValueError fallbacks:
- Large integers (10**5000) exceeding sys.get_int_max_str_digits()
  in node __str__, Const.getitem, and InferenceContext.__str__
- Basic InferenceContext.__str__ coverage

* Drop context.py changes per reviewer feedback

Remove InferenceContext.__str__ hardening and its tests, keeping
only the directly-triggered fixes in node_ng.py, objectmodel.py,
and node_classes.py.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
(cherry picked from commit 2c08ac19bd34e6715c188731ebfefbac77c244b1)
5 files changed