How to correctly update dimensions of text objects via bpy?

I have posted this question at Blender stack :

I have written a script that changes fonts on two default text objects and then updates the text object dimensions, but dimensions won’t get updated. Is this a known bug, or is there something I am missing ?

EDIT: Just fixed it, I have updated the Blender stack answer