The documentation suggests that this old code
width, height = font.getsize("Hello world")
should be replaced by
left, top, right, bottom = font.getbbox("Hello world")
width, height = right - left, bottom - top
A 1:1 replacement would require different new code
left, top, right, bottom = font.getbbox("Hello world")
width, height = right - left, bottom
The documentation should mention that and maybe link to this comment.