mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 03:50:16 +00:00
...
This commit is contained in:
parent
1735e0d3b8
commit
90eb50a3a5
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user