py/objdict: Add explicit __init__ method.
Which in CPython, surprisingly, has the same behavior as .update().
/*
- * This file is part of the MicroPython project, http://micropython.org/
+ * This file is part of the Pycopy project, https://github.com/pfalcon/pycopy
+ * This file was part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2014-2017 Paul Sokolovsky
+ * Copyright (c) 2014-2021 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -575,6 +576,10 @@ STATIC const mp_rom_map_elem_t dict_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___getitem__), MP_ROM_PTR(&mp_op_getitem_obj) },
{ MP_ROM_QSTR(MP_QSTR___setitem__), MP_ROM_PTR(&mp_op_setitem_obj) },
{ MP_ROM_QSTR(MP_QSTR___delitem__), MP_ROM_PTR(&mp_op_delitem_obj) },
+ #if MICROPY_PY_NATIVE_TYPE_INIT_METHODS
+ // In CPython, dict.__init__ has the same behavior as .update().
+ { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&dict_update_obj) },
+ #endif
};
STATIC MP_DEFINE_CONST_DICT(dict_locals_dict, dict_locals_dict_table);
