“…there is another reason why he mentions Tamar, who does not appear to be praiseworthy on account of her physical relations with her father-in-law; and that was to show that Christ Who accepted all things for our sake, accepted even to have such forbears as these. It was moreover for this very reason that He was born from them, that He might sanctify them; for He came not to call the righteous, but the sinners.”

(St Theophylact, ‘Commentary on Matthew’)