-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use debugPrint
instead of str
for fail
arguments
#18818
Conversation
debugPrint
instead of str
for fail
parametersdebugPrint
instead of str
for fail
arguments
@brandjon Could you take a look at this? It's a very lightweight alternative to #17889, aiming to resolve #17375. Some change along these lines is necessary to make Bzlmod module extension error messages comprehensible - there is currently no way for them to point to the actual location that is the cause of a user error. CC @Wyverald |
@sgowroji While this would be applied to Bzlmod, the change affects the Starlark interpreter only - could you assign it to the respective team? |
@brandjon Friendly ping, on the spectrum of the incompatible changes this should be tiny, but still very useful for Bzlmod's ability to generate error messages. It would be great to improve the situation in some way for Bazel 7. In case you are busy, could @tetromino review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we reuse the same Printer?
I pushed a commit to reuse the printer. |
Thanks! |
@bazel-io flag |
@bazel-io fork 6.4.0 |
This allows non-hermetic information (such as Starlark `Location`s) to be included in `fail` messages without allowing access to it from Starlark. It also aligns the content of `fail` output with that of `print`. This change has very mild implications for backwards compatibility: it only affects the contents of `fail` messages, which aren't accessible from Starlark; `debugPrint`'s default implementation is `str` and no built-in Starlark type overrides it; if a type overrides `debugPrint`, it would usually contain at least as detailed information as `str`; `debugPrint` is a "Bazelism" that isn't governed by the Starlark spec. Work towards bazelbuild#17375 Closes bazelbuild#18818. Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com> PiperOrigin-RevId: 557916312 Change-Id: I8f202cd8530bcebb2d99f57745289b3992d03cac
This allows non-hermetic information (such as Starlark `Location`s) to be included in `fail` messages without allowing access to it from Starlark. It also aligns the content of `fail` output with that of `print`. This change has very mild implications for backwards compatibility: it only affects the contents of `fail` messages, which aren't accessible from Starlark; `debugPrint`'s default implementation is `str` and no built-in Starlark type overrides it; if a type overrides `debugPrint`, it would usually contain at least as detailed information as `str`; `debugPrint` is a "Bazelism" that isn't governed by the Starlark spec. Work towards #17375 Closes #18818. Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com> Commit 3abbf20 PiperOrigin-RevId: 557916312 Change-Id: I8f202cd8530bcebb2d99f57745289b3992d03cac Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im> Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com>
This allows non-hermetic information (such as Starlark
Location
s) to be included infail
messages without allowing access to it from Starlark. It also aligns the content offail
output with that ofprint
.This change has very mild implications for backwards compatibility: it only affects the contents of
fail
messages, which aren't accessible from Starlark;debugPrint
's default implementation isstr
and no built-in Starlark type overrides it; if a type overridesdebugPrint
, it would usually contain at least as detailed information asstr
;debugPrint
is a "Bazelism" that isn't governed by the Starlark spec.Work towards #17375