Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
f5f6c3b7
Commit
f5f6c3b7
authored
Jun 15, 2014
by
Paul Sokolovsky
Browse files
streams: Reading by char count from unicode text streams is not implemented.
parent
ce81312d
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/stream.c
View file @
f5f6c3b7
...
...
@@ -33,6 +33,7 @@
#include
"qstr.h"
#include
"obj.h"
#include
"objstr.h"
#include
"runtime.h"
#include
"stream.h"
#if MICROPY_STREAMS_NON_BLOCK
#include
<errno.h>
...
...
@@ -67,6 +68,13 @@ STATIC mp_obj_t stream_read(uint n_args, const mp_obj_t *args) {
if
(
n_args
==
1
||
((
sz
=
mp_obj_get_int
(
args
[
1
]))
==
-
1
))
{
return
stream_readall
(
args
[
0
]);
}
#if MICROPY_PY_BUILTINS_STR_UNICODE
if
(
!
o
->
type
->
stream_p
->
is_bytes
)
{
mp_not_implemented
(
"Reading from unicode text streams by character count"
);
}
#endif
byte
*
buf
=
m_new
(
byte
,
sz
);
int
error
;
machine_int_t
out_sz
=
o
->
type
->
stream_p
->
read
(
o
,
buf
,
sz
,
&
error
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment