Tuya (not local) integration error (and Python 3.11?)

Hello there,

I’ve just upgraded to Python 3.11 and get an error at each startup.
As I’m not using tuya lights, it doesn’t prevent HA to work as expected but something is wrong.

Mar 04 21:05:52 hassbian hass[5101]: 2023-03-04 21:05:49.958 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.tuya.light
Mar 04 21:05:52 hassbian hass[5101]: Traceback (most recent call last):
Mar 04 21:05:52 hassbian hass[5101]:   File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 779, in get_platform
Mar 04 21:05:52 hassbian hass[5101]:     cache[full_name] = self._import_platform(platform_name)
Mar 04 21:05:52 hassbian hass[5101]:                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 796, in _import_platform
Mar 04 21:05:52 hassbian hass[5101]:     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
Mar 04 21:05:52 hassbian hass[5101]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
Mar 04 21:05:52 hassbian hass[5101]:     return _bootstrap._gcd_import(name[level:], package, level)
Mar 04 21:05:52 hassbian hass[5101]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
Mar 04 21:05:52 hassbian hass[5101]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Mar 04 21:05:52 hassbian hass[5101]:   File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/components/tuya/light.py", line 52, in <module>
Mar 04 21:05:52 hassbian hass[5101]:     @dataclass
Mar 04 21:05:52 hassbian hass[5101]:      ^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/usr/local/lib/python3.11/dataclasses.py", line 1220, in dataclass
Mar 04 21:05:52 hassbian hass[5101]:     return wrap(cls)
Mar 04 21:05:52 hassbian hass[5101]:            ^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/usr/local/lib/python3.11/dataclasses.py", line 1210, in wrap
Mar 04 21:05:52 hassbian hass[5101]:     return _process_class(cls, init, repr, eq, order, unsafe_hash,
Mar 04 21:05:52 hassbian hass[5101]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/usr/local/lib/python3.11/dataclasses.py", line 958, in _process_class
Mar 04 21:05:52 hassbian hass[5101]:     cls_fields.append(_get_field(cls, name, type, kw_only))
Mar 04 21:05:52 hassbian hass[5101]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 04 21:05:52 hassbian hass[5101]:   File "/usr/local/lib/python3.11/dataclasses.py", line 815, in _get_field
Mar 04 21:05:52 hassbian hass[5101]:     raise ValueError(f'mutable default {type(f.default)} for field '
Mar 04 21:05:52 hassbian hass[5101]: ValueError: mutable default <class 'homeassistant.components.tuya.light.ColorTypeData'> for field default_color_type is not allowed: use default_factory
Mar 04 21:05:52 hassbian hass[5101]: 2023-03-04 21:05:50.032 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform tuya.light: Platform not found (Exception importing homeassistant.components.tuya.light).

Am I the only one?
Error is

ValueError: mutable default <class ‘homeassistant.components.tuya.light.ColorTypeData’> for field default_color_type is not allowed: use default_factory

EDIT Found in the release note of Python 3.11

dataclasses

  • Change field default mutability check, allowing only defaults which are hashable instead of any object which is not an instance of dict, list or set. (Contributed by Eric V. Smith in bpo-44674.)

EDIT 2 Issue opened in the GitHub of the integration, will follow-up there