From d288ae8eb90035d11e9dde3aa5db2adc9136baa2 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 9 Dec 2015 22:01:29 +0200 Subject: [PATCH] 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. --- unix/modtermios.c | 6 ++++-- 1 file 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);