Skip to content
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

bricks/_common/mpconfigport: enable unicode support #271

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

dlech
Copy link
Member

@dlech dlech commented Oct 27, 2024

Enable MICROPY_PY_BUILTINS_STR_UNICODE on hubs with PYBRICKS_OPT_EXTRA_MOD.

Without this, there is not any difference between str and bytes, which can make it hard to work with multi-byte characters.

This takes up about 1700 bytes on Technic hub.

Related discussion: https://github.com/orgs/pybricks/discussions/1882#discussioncomment-10962184

@coveralls
Copy link

coveralls commented Oct 27, 2024

Coverage Status

coverage: 56.36%. remained the same
when pulling 8137ff5 on dlech:unicode
into 1d1d850 on pybricks:master.

@laurensvalk
Copy link
Member

Will this have any effect on functions or methods that currently accept both bytes and strings? (I have not looked into this yet, just wondering).

@dlech
Copy link
Member Author

dlech commented Oct 28, 2024

Will this have any effect on functions or methods that currently accept both bytes and strings?

No, anything that accepts both would be using the buffer protocol, so nothing would change there.

@laurensvalk
Copy link
Member

This would be too big for Technic Hub at the moment. Since Prime Hub does seem to gradually become the most popular hub, I suppose we could add a level above PYBRICKS_OPT_EXTRA_MOD for extra features like these.

@laurensvalk laurensvalk force-pushed the unicode branch 2 times, most recently from 48d405a to 47bb9a7 Compare December 5, 2024 10:09
laurensvalk and others added 2 commits December 5, 2024 11:15
Allows for additional features to be grouped as LEVEL2 on hubs with more space.
Enable MICROPY_PY_BUILTINS_STR_UNICODE on hubs with PYBRICKS_OPT_EXTRA_LEVEL2.

Without this, there is not any difference between str and bytes, which
can make it hard to work with multi-byte characters.
@laurensvalk laurensvalk merged commit 8137ff5 into pybricks:master Dec 5, 2024
20 checks passed
@laurensvalk
Copy link
Member

Merged and enabled on hubs with PYBRICKS_OPT_EXTRA_LEVEL2

@dlech dlech deleted the unicode branch December 5, 2024 15:01
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