Ibn Abbas said, "If a man declares his wife forbidden to himself, it amounts to nothing." He then recited, "Indeed, you have in the Messenger of Allah an excellent example" [Ahzab 33:21].
إذا حرم امرأته ليس بشيء وقال: {لقد كان لكم في رسول الله أسوة حسنة} [الأحزاب: ٢١].
Bukhari related it in the Book of Divorce (5266), and Muslim in the Book of Divorce (19:1473), both by way of Muawiya bin Salam, from Yahya bin Abu Kathir, that Yaala bin Hakeem informed him, that Saeed bin Jubayr informed him that he heard Ibn Abbas say, and he mentioned it. The wording given is Bukhari's. Muslim's wording is, "If a man declares his wife forbidden to himself, it is an oath that he must atone for."