File tree 3 files changed +13
-1
lines changed 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,11 @@ typedef double mp_float_t;
249
249
#define MICROPY_PATH_MAX (512)
250
250
#endif
251
251
252
+ // Whether POSIX-semantics non-blocking streams are supported
253
+ #ifndef MICROPY_STREAMS_NON_BLOCK
254
+ #define MICROPY_STREAMS_NON_BLOCK (0)
255
+ #endif
256
+
252
257
// Whether to use computed gotos in the VM, or a switch
253
258
// Computed gotos are roughly 10% faster, and increase VM code size by a little
254
259
#ifndef MICROPY_USE_COMPUTED_GOTO
Original file line number Diff line number Diff line change 25
25
*/
26
26
27
27
#include <string.h>
28
- #include <errno.h>
29
28
30
29
#include "mpconfig.h"
31
30
#include "nlr.h"
32
31
#include "misc.h"
33
32
#include "qstr.h"
34
33
#include "obj.h"
35
34
#include "stream.h"
35
+ #if MICROPY_STREAMS_NON_BLOCK
36
+ #include <errno.h>
37
+ #endif
36
38
37
39
// This file defines generic Python stream read/write methods which
38
40
// dispatch to the underlying stream interface of an object.
42
44
43
45
STATIC mp_obj_t stream_readall (mp_obj_t self_in );
44
46
47
+ #if MICROPY_STREAMS_NON_BLOCK
45
48
// TODO: This is POSIX-specific (but then POSIX is the only real thing,
46
49
// and anything else just emulates it, right?)
47
50
#define is_nonblocking_error (errno ) ((errno) == EAGAIN || (errno) == EWOULDBLOCK)
51
+ #else
52
+ #define is_nonblocking_error (errno ) (0)
53
+ #endif
48
54
49
55
STATIC mp_obj_t stream_read (uint n_args , const mp_obj_t * args ) {
50
56
struct _mp_obj_base_t * o = (struct _mp_obj_base_t * )args [0 ];
Original file line number Diff line number Diff line change 39
39
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
40
40
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
41
41
#define MICROPY_PATH_MAX (PATH_MAX)
42
+ #define MICROPY_STREAMS_NON_BLOCK (1)
42
43
#define MICROPY_USE_COMPUTED_GOTO (1)
43
44
#define MICROPY_MOD_SYS_STDFILES (1)
44
45
#define MICROPY_ENABLE_MOD_CMATH (1)
You can’t perform that action at this time.
0 commit comments