From f2baa9ec245a66c4cd7d990e39a4af3f6fab1cb7 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 19 Oct 2017 12:40:41 +0300 Subject: [PATCH] py/objtype: Use CPython compatible method name for sizeof. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://docs.python.org/3/library/sys.html#sys.getsizeof: getsizeof() calls the object’s __sizeof__ method. Previously, "getsizeof" was used mostly to save on new qstr, as we don't really support calling this method on arbitrary objects (so it was used only for reporting). However, normalize it all now. --- py/objtype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/objtype.c b/py/objtype.c index 9a639ef035..45b119f451 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -342,7 +342,7 @@ const uint16_t mp_unary_op_method_name[MP_UNARY_OP_NUM_RUNTIME] = { [MP_UNARY_OP_INVERT] = MP_QSTR___invert__, #endif #if MICROPY_PY_SYS_GETSIZEOF - [MP_UNARY_OP_SIZEOF] = MP_QSTR_getsizeof, + [MP_UNARY_OP_SIZEOF] = MP_QSTR___sizeof__, #endif };