summaryrefslogtreecommitdiffstatshomepage
path: root/unix/modtermios.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-12-09 22:01:29 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-12-09 22:01:29 +0200
commitd288ae8eb90035d11e9dde3aa5db2adc9136baa2 (patch)
tree8c3826c8519069ba2ccd817f652065a156cc2428 /unix/modtermios.c
parentce936edf62484bf46205eac48cdfb9b7b28a64b9 (diff)
downloadmicropython-d288ae8eb90035d11e9dde3aa5db2adc9136baa2.tar.gz
micropython-d288ae8eb90035d11e9dde3aa5db2adc9136baa2.zip
unix/modtermios: DJGPP appears to have unicode-capable cc_t type.
At least it's defined as "unsiged". We don't try to support unicode still, but at least apply workaround for DJGPP build.
Diffstat (limited to 'unix/modtermios.c')
-rw-r--r--unix/modtermios.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/unix/modtermios.c b/unix/modtermios.c
index 94074e1d00..38be729e22 100644
--- a/unix/modtermios.c
+++ b/unix/modtermios.c
@@ -59,8 +59,10 @@ STATIC mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
cc->items[i] = MP_OBJ_NEW_SMALL_INT(term.c_cc[i]);
} else {
// https://docs.python.org/3/library/termios.html says value is *string*,
- // but no way unicode chars could be there.
- cc->items[i] = mp_obj_new_bytes(&term.c_cc[i], 1);
+ // but no way unicode chars could be there, if c_cc is defined to be a
+ // a "char". But it's type is actually cc_t, which can be anything.
+ // TODO: For now, we still deal with it like that.
+ cc->items[i] = mp_obj_new_bytes((byte*)&term.c_cc[i], 1);
}
}
return MP_OBJ_FROM_PTR(r);