Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit f2baa9e

Browse files
author
Paul Sokolovsky
committed
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.
1 parent 93ce125 commit f2baa9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/objtype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ const uint16_t mp_unary_op_method_name[MP_UNARY_OP_NUM_RUNTIME] = {
342342
[MP_UNARY_OP_INVERT] = MP_QSTR___invert__,
343343
#endif
344344
#if MICROPY_PY_SYS_GETSIZEOF
345-
[MP_UNARY_OP_SIZEOF] = MP_QSTR_getsizeof,
345+
[MP_UNARY_OP_SIZEOF] = MP_QSTR___sizeof__,
346346
#endif
347347
};
348348

0 commit comments

Comments
 (0)