diff options
author | Matthias Urlichs <matthias@urlichs.de> | 2023-10-06 21:02:43 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-10-09 09:46:02 +1100 |
commit | 3fb1bb131f43207e2201a61139cd3f6e82d6513f (patch) | |
tree | 65b05255a532421a8d2384ff2dd6b6351ee4ca10 /py/vm.c | |
parent | 5232847771903e9022c8c67a436b0562e4530602 (diff) |
py/vm: Don't emit warning when using "raise ... from None".
"Raise SomeException() from None" is a common Python idiom to suppress
chained exceptions and thus shouldn't trigger a warning on a version of
Python that doesn't support them in the first place.
Diffstat (limited to 'py/vm.c')
-rw-r--r-- | py/vm.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1171,8 +1171,10 @@ unwind_return: ENTRY(MP_BC_RAISE_FROM): { MARK_EXC_IP_SELECTIVE(); - mp_warning(NULL, "exception chaining not supported"); - sp--; // ignore (pop) "from" argument + mp_obj_t from_value = POP(); + if (from_value != mp_const_none) { + mp_warning(NULL, "exception chaining not supported"); + } mp_obj_t obj = mp_make_raise_obj(TOP()); RAISE(obj); } |