Files
searxng/searx
Markus Heiser d16283d93a [fix:py3.14] using a non-empty mutable collection as default is unsafe
Starting with Python 3.14 msgspec reports::

    File "/share/searxng/searx/weather.py", line 261, in <module>
        class Temperature(msgspec.Struct, kw_only=True):
        ...<60 lines>...
                return template.format(value=val_str, unit=unit)
    TypeError: Using a non-empty mutable collection (['°C', '°F', 'K']) \
               as a default value is unsafe.\
               Instead configure a `default_factory` for this field.

The problem is solved by the fact that there are now global constants for the
units (BTW singular/plural names of the type definitions are fixed):

- TEMPERATURE_UNITS
- PRESSURE_UNITS
- WIND_SPEED_UNITS
- RELATIVE_HUMIDITY_UNITS
- COMPASS_POINTS
- COMPASS_UNITS

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-10-08 13:47:22 +02:00
..