diff options
| author | Laurens Valk <laurens@pybricks.com> | 2022-11-21 21:35:26 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-07-25 12:01:43 +1000 |
| commit | 9ca668f881865958cbcc0e6341849a6133c4c7b4 (patch) | |
| tree | 5bc69513c0fa68868aa7f6dedb69a542363eb8f1 /tests/basics/subclass_classmethod.py | |
| parent | 19b1333cb1376ef60376a07e8e76a41854014840 (diff) | |
py/objtype: Avoid crash on calling members of uninitialized native type.
When subclassing a native type, calling native members in `__init__` before
`super().__init__()` has been called could cause a crash. In this
situation, `self` in `mp_convert_member_lookup` is the
`native_base_init_wrapper_obj`. The check added in this commit ensures
that an `AttributeError` is raised before this happens, which is consistent
with other failed lookups.
Also fix a typo in a related comment.
Signed-off-by: Laurens Valk <laurens@pybricks.com>
Diffstat (limited to 'tests/basics/subclass_classmethod.py')
0 files changed, 0 insertions, 0 deletions
