-
Notifications
You must be signed in to change notification settings - Fork 1.3k
bytes objects lack a decode method in smaller non-Express builds #384
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
Comments
This should be as easy as enabling a define in mpconfigport.h |
The flag for this is
|
@dhalbert I think this is a good candidate for using some of the space you freed. What do you think? Anyone know what the code size cost of enabling this is? |
But from that comment, wouldn't just |
Turning on @gpshead: is (Note that |
I wonder if it would make sense to actually disable |
Workaround As for disabling in the larger build... I'm in favor of that when reasonable workarounds exist (as in this case). The fewer behavior differences between different circuitpython builds the better; though I could just as easily argue the other way with regards to being compatible with Micropython on larger microcontrollers. |
I think we should disable this for consistency across atmel-samd, esp8266, and nrf builds, as suggested by @deshipu above. The features added by |
The
decode
method for converting from bytes to str is missing in non-Express builds. This makes it awkward to take data from I/O and print it. It seems like this should exist, obviously the codec is ignored on a microcontroller but being able to switch immutable data types from one that iterates as ints to one that is printable and iterates as one character strings is desirable. Depending on the micropython gc internals both could share the same data buffer behind the scenes (I haven't looked inside that box yet...).Workaround, a silly looking:
''.join(chr(b) for b in bytes_data)
Noticed when using the Feather M0 Basic 2.1.0 circuitpython release. I had to work around this when moving code over from where I developed it on an Express.
The text was updated successfully, but these errors were encountered: