From 90eb50a3a55fca04a517bc6c3ef468d3f640bae7 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 5 Aug 2024 16:54:48 +0800 Subject: [PATCH] ... --- src/public/modules.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/public/modules.c b/src/public/modules.c index e83e0c97..db471cc3 100644 --- a/src/public/modules.c +++ b/src/public/modules.c @@ -386,12 +386,14 @@ static bool builtins_hasattr(int argc, py_Ref argv) { PY_CHECK_ARGC(2); PY_CHECK_ARG_TYPE(1, tp_str); py_Name name = py_namev(py_tosv(py_arg(1))); + py_StackRef p0 = py_peek(0); bool ok = py_getattr(py_arg(0), name); if(ok) { py_newbool(py_retval(), true); return true; } if(py_matchexc(tp_AttributeError)) { + py_clearexc(p0); py_newbool(py_retval(), false); return true; }