소스 검색

Fix runtime error on python 3.11.0 (#4197)

All generic types present in a Union must be parametrized on 3.11.0 if any
other generic types in the union are parametrized.

This appears to be a bug in 3.11.0, as the behavior is not observed in 3.11.1
or 3.10; fixing here as this is technically more correct anyway and avoids a
crash.
Masen Furer 7 달 전
부모
커밋
b112d35f62
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      reflex/event.py

+ 1 - 1
reflex/event.py

@@ -1412,7 +1412,7 @@ class ToEventChainVarOperation(ToOperation, EventChainVar):
 
 G = ParamSpec("G")
 
-IndividualEventType = Union[EventSpec, EventHandler, Callable[G, Any], Var]
+IndividualEventType = Union[EventSpec, EventHandler, Callable[G, Any], Var[Any]]
 
 EventType = Union[IndividualEventType[G], List[IndividualEventType[G]]]