With automake master, on an Ubuntu 22.04 system (with Python 3.10), I don't believe anyone has tried Automake with Python 3.10 before. Mike and Bogdan put in quite a bit of work getting the current tests to work with other versions of Python. Evidently every Python version does new and different incompatible things.
Regrettably, I can't debug or fix this (or anything wrt Python). I hope you or someone else can provide a patch. Thanks for the report. -k