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.
pull/3377/head
Paul Sokolovsky 2017-10-19 12:40:41 +03:00
rodzic 93ce125abe
commit f2baa9ec24
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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
};