In Emacs version 24.5.3.
It seems that term.el has changed since this bug was first reported two years ago. Is there a reason that Johan's patch isn't accepted?
By the looking, this bug can bite term.el users at random time. It would be great to have it fixed in the mainline sooner.
Regards,
Jiangbin