summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorAyke van Laethem <aykevanlaethem@gmail.com>2018-04-24 17:43:14 +0200
committerDamien George <damien.p.george@gmail.com>2018-05-01 15:54:50 +1000
commitd43c7377564b3e1be36f627a465df2c5779a1ae8 (patch)
tree8754283d6817b263927c469d1c91e3f8761aa526 /py
parent96740be3574d91279ca883adbb19b976413ef52b (diff)
py/stream: Use uPy errno instead of system's for non-blocking check.
This is a more consistent use of errno codes. For example, it may be that a stream returns MP_EAGAIN but the mp_is_nonblocking_error() macro doesn't catch this value because it checks for EAGAIN instead (which may have a different value than MP_EAGAIN when MICROPY_USE_INTERNAL_ERRNO is enabled).
Diffstat (limited to 'py')
-rw-r--r--py/stream.c7
-rw-r--r--py/stream.h2
2 files changed, 1 insertions, 8 deletions
diff --git a/py/stream.c b/py/stream.c
index f51f634b6..393988d2c 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -32,13 +32,6 @@
#include "py/stream.h"
#include "py/runtime.h"
-#if MICROPY_STREAMS_NON_BLOCK
-#include <errno.h>
-#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
-#define EWOULDBLOCK 140
-#endif
-#endif
-
// This file defines generic Python stream read/write methods which
// dispatch to the underlying stream interface of an object.
diff --git a/py/stream.h b/py/stream.h
index a7d8d08f1..a1d1c4f8a 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -107,7 +107,7 @@ int mp_stream_posix_fsync(mp_obj_t stream);
#endif
#if MICROPY_STREAMS_NON_BLOCK
-#define mp_is_nonblocking_error(errno) ((errno) == EAGAIN || (errno) == EWOULDBLOCK)
+#define mp_is_nonblocking_error(errno) ((errno) == MP_EAGAIN || (errno) == MP_EWOULDBLOCK)
#else
#define mp_is_nonblocking_error(errno) (0)
#endif