We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce81312 commit f5f6c3bCopy full SHA for f5f6c3b
1 file changed
py/stream.c
@@ -33,6 +33,7 @@
33
#include "qstr.h"
34
#include "obj.h"
35
#include "objstr.h"
36
+#include "runtime.h"
37
#include "stream.h"
38
#if MICROPY_STREAMS_NON_BLOCK
39
#include <errno.h>
@@ -67,6 +68,13 @@ STATIC mp_obj_t stream_read(uint n_args, const mp_obj_t *args) {
67
68
if (n_args == 1 || ((sz = mp_obj_get_int(args[1])) == -1)) {
69
return stream_readall(args[0]);
70
}
71
+
72
+ #if MICROPY_PY_BUILTINS_STR_UNICODE
73
+ if (!o->type->stream_p->is_bytes) {
74
+ mp_not_implemented("Reading from unicode text streams by character count");
75
+ }
76
+ #endif
77
78
byte *buf = m_new(byte, sz);
79
int error;
80
machine_int_t out_sz = o->type->stream_p->read(o, buf, sz, &error);
0 commit comments