Skip to content

Commit 95b823d

Browse files
committed
Fix edge case were strictly_equal could throw an exception
1 parent 64c9b63 commit 95b823d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/reactpy/core/hooks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,12 @@ def strictly_equal(x: Any, y: Any) -> bool:
597597

598598
# Compare the source code of lambda and local functions
599599
if (
600-
hasattr(x, "__qualname__")
600+
getattr(x, "__qualname__", "")
601+
and getattr(y, "__qualname__", "")
601602
and ("<lambda>" in x.__qualname__ or "<locals>" in x.__qualname__)
603+
and ("<lambda>" in y.__qualname__ or "<locals>" in y.__qualname__)
602604
and hasattr(x, "__code__")
605+
and hasattr(y, "__code__")
603606
):
604607
if x.__qualname__ != y.__qualname__:
605608
return False

0 commit comments

Comments
 (0)