Error installing homeassistant-pyozw on RPI3 + Python 3.10

I decided to update my existing virtual environment from Python 3.8 (where I now get I warning message about using an old Python version) so I upgraded to Python 3.10, but installation of Home Assistant fails when building the wheel for homeassistant-pyozw:

Collecting homeassistant-pyozw
  Using cached homeassistant_pyozw-0.1.10.zip (147 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six in ./lib/python3.10/site-packages (from homeassistant-pyozw) (1.16.0)
Requirement already satisfied: PyDispatcher>=2.0.5 in ./lib/python3.10/site-packages (from homeassistant-pyozw) (2.0.5)
Building wheels for collected packages: homeassistant-pyozw
  Building wheel for homeassistant-pyozw (setup.py) ...

  ...

  /usr/local/include/python3.10/object.h:133:58: error: lvalue required as decrement operand
   #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))

  ...
error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for homeassistant-pyozw

Works fine with Python 3.8. Any clues? RPI packages are up to date.

Downgraded to Python 3.9, works now.

The message about updating Python version states “Upgrade to Python 3.9 or later”. Since python.org now recommends 3.10, anyone following these recommendations will end up with this error.