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).
This commit is contained in:
parent
96740be357
commit
d43c737756
|
@ -32,13 +32,6 @@
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "py/runtime.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
|
// This file defines generic Python stream read/write methods which
|
||||||
// dispatch to the underlying stream interface of an object.
|
// dispatch to the underlying stream interface of an object.
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ int mp_stream_posix_fsync(mp_obj_t stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MICROPY_STREAMS_NON_BLOCK
|
#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
|
#else
|
||||||
#define mp_is_nonblocking_error(errno) (0)
|
#define mp_is_nonblocking_error(errno) (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue