Merge Stefano's fixes for Python 3.10

3 jobs for master in 13 minutes and 7 seconds (queued for 6 seconds)