summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-10-19 12:40:41 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-10-19 12:44:53 +0300
commitf2baa9ec245a66c4cd7d990e39a4af3f6fab1cb7 (patch)
tree6b021b7ce51dbab0796670e469f441a6b565f9fd
parent93ce125abe41b5527eb92e483e64cc6d1a027ba0 (diff)
py/objtype: Use CPython compatible method name for sizeof.
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.
-rw-r--r--py/objtype.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 9a639ef03..45b119f45 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
};