Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Jan 26, 2024

Make error messages terse when CIRCUITPY_FULL_BUILD = 0. This saves about 1000 bytes on the en_US build and 1200 bytes on the ru build, which was overflowing.

@dhalbert dhalbert requested review from tannewt and jepler January 26, 2024 19:23
@dhalbert
Copy link
Collaborator Author

Examples of TERSE vs NORMAL messages. The messages are still quite understandable; you just have to look at the context more carefully

"__init__() should return None"
"__init__() should return None, not '%s'"

"name not defined"
"name '%q' is not defined"

"cannot create instance"
"cannot create '%q' instances"

"unsupported type for operator"
"unsupported type for %q: '%s'"

"wrong number of values to unpack"
"need more than %d values to unpack"

"object not callable"
"'%q' object is not callable"

"indices must be integers"
"%q indices must be integers, not %s"

Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself clearly does what it intends to do.

I think that as a practical matter we are going to have to do something about our most flash-constrained boards. Personally, I think this is a reasonable step to take, so that they don't hold back our overall progress.

@tannewt
Copy link
Member

tannewt commented Jan 29, 2024

Is the space saved because there are more shared messages? I'd really rather not do this but understand we're hitting a code size wall on SAMD21.

@jepler
Copy link

jepler commented Jan 29, 2024

My understanding is, they're terser, and some forego any %-formatting which also saves code space. There are definitely some that combine too, see mp_arg_error_terse_mismatch.

@dhalbert
Copy link
Collaborator Author

@tannewt Is it OK to merge this, to prevent further failed builds?

I am not sure why you'd rather not do this. Is it because the messages are different, because they are less informative, or some other reason?

My feeling is that they are almost the same, and only slightly less explicative. I don't foresee this being much of a support issue at all.

@tannewt
Copy link
Member

tannewt commented Jan 31, 2024

Ya I'm ok merging it now to unblock us. I may try and turn it back on later if I come up with free space some other way.

I hesitate because good error messages are really helpful. We don't always have a good understanding of why the builds are growing either. I think we can be more disciplined about feature freezing to save the space instead.

@tannewt tannewt merged commit 96be941 into adafruit:main Jan 31, 2024
@dhalbert dhalbert deleted the terse-errors branch February 16, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants