reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
20.42k stars 1.18k forks source link

[ENG-4137] Handle generic alias passing inspect.isclass check #4427

Closed masenf closed 1 day ago

masenf commented 2 days ago

On py3.9 and py3.10, dict[str, str] and other typing forms are kinda considered classes, but they still fail when doing issubclass, so specifically exclude generic aliases before calling issubclass.

Fix #4424

Bonus fix: support upcasting of pydantic v1 and v2 models

Adds some test coverage to this sorta dodgy bit of code that has already introduced at least 3 bugs since being added.

linear[bot] commented 2 days ago

ENG-4137 issubclass() arg 1 must be a class