core[patch] Do not try to access attribute of None (#16321)

This commit is contained in:
Nuno Campos
2024-01-22 22:10:03 -08:00
committed by GitHub
parent 4b7969efc5
commit 226fe645f1

View File

@@ -248,7 +248,12 @@ def get_function_nonlocals(func: Callable) -> List[Any]:
if "." in kk and kk.startswith(k):
vv = v
for part in kk.split(".")[1:]:
vv = getattr(vv, part)
if vv is None:
break
else:
vv = getattr(vv, part)
else:
values.append(vv)
values.append(vv)
return values
except (SyntaxError, TypeError, OSError):