From c5aa2e93001436f6d63e3e9b7dff3c535397db1c Mon Sep 17 00:00:00 2001 From: Noralf Trønnes Date: Mon, 12 Nov 2018 16:16:47 +0100 Subject: Support OSError attributes This adds support for the OSError attributes : errno, strerror, filename and filename2. CPython only sets errno if 2 arguments has been passed in. This has not been implemented here. CPython OSError.args is capped at 2 items for backward compatibility reasons. This has not been implemented here. MICROPY_CPYTHON_COMPAT has to be enabled to get these attributes. mp_common_errno_to_str() has been extended to check mp_errno_to_str() as well. This is done to ease reuse for the strerror argument. --- py/mperrno.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'py/mperrno.h') diff --git a/py/mperrno.h b/py/mperrno.h index 876b090b5..911a9b413 100644 --- a/py/mperrno.h +++ b/py/mperrno.h @@ -141,7 +141,6 @@ #endif const char* mp_errno_to_str(mp_obj_t errno_val); -// For commonly encountered errors, return compressed human readable strings -const compressed_string_t* mp_common_errno_to_str(mp_obj_t errno_val); +const char *mp_common_errno_to_str(mp_obj_t errno_val, char *buf, size_t len); #endif // MICROPY_INCLUDED_PY_MPERRNO_H -- cgit v1.2.3