It appears that this (or maybe another changeset in this series, I'm not sure), broke the pytype tests: https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/457121
@indygreg could you follow-up?
It isn't surprising that pytype broke as a result of this series. I suspect what happened is the removal of a bunch of Python 2 code paths enabled pytype to make different (hopefully more accurate) inferences about types and this resulted in fallout. There's a good chance this will actually reveal legitimate typing bugs in the code base.
I'll try to take a look in a few hours.