summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-10-30 16:36:41 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-10-31 00:00:39 +0200
commit31619cc5893b8066799e663683ea9a7ea29602e1 (patch)
treea7c8958e45d0597296acaae47be9496d4f8c3318
parent11aa91615ec21229742fb4551e4610f83d61eec7 (diff)
downloadmicropython-31619cc5893b8066799e663683ea9a7ea29602e1.tar.gz
micropython-31619cc5893b8066799e663683ea9a7ea29602e1.zip
py: mp_obj_str_get_str(): Work with bytes too.
It should be fair to say that almost in all cases where some API call expects string, it should be also possible to pass byte string. For example, it should be open/delete/rename file with name as bytestring. Note that similar change was done quite a long ago to mp_obj_str_get_data().
-rw-r--r--py/objstr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objstr.c b/py/objstr.c
index b008dc6c17..b27498d359 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1895,7 +1895,7 @@ qstr mp_obj_str_get_qstr(mp_obj_t self_in) {
// only use this function if you need the str data to be zero terminated
// at the moment all strings are zero terminated to help with C ASCIIZ compatibility
const char *mp_obj_str_get_str(mp_obj_t self_in) {
- if (MP_OBJ_IS_STR(self_in)) {
+ if (MP_OBJ_IS_STR_OR_BYTES(self_in)) {
GET_STR_DATA_LEN(self_in, s, l);
(void)l; // len unused
return (const char*)s;