He heard the Messenger of Allah ﷺ, when he raised his head from bowing in the final rakah of the dawn prayer, say, "O Allah, curse so-and-so, so-and-so, and so-and-so," after saying, "Allah hears whoever praises Him. Our Lord, to You belongs all praise."Then Allah the Exalted revealed, "Not for you is the matter at all" until His statement, "for indeed, they are wrongdoers" [Aal Imran 3:128].
أنه سمع رسول الله ﷺ إذا رفع رأسه من الركوع من الركعة الآخرة من الفجر، يقول: اللهم العن فلانا وفلانا وفلانا بعد ما يقول: سمع الله لمن حمده، ربنا ولك الحمد فأنزل الله تعالى: {ليس لك من الأمر شيء} إلى قوله: {فإنهم ظلمون}.
Bukhari narrated it in Kitab al-Maghazi (4069) from Yahya bin Abdullah Sulami, who said, Abdullah (that is, Ibn Mubarak) informed us, Mamar informed us, from Zuhri, who said, Salim narrated to me, from his father Abdullah, and he related it. He said, from Hanzala bin Abu Sufyan, I heard Salim bin Abdullah say, the Messenger of Allah ﷺ used to pray against Safwan bin Umaya, Suhayl bin Amr, and Harith bin Hisham, and then the verse was revealed, "You have no part in the matter" up to His saying "for they are wrongdoers". Bukhari narrated it in Kitab al-Maghazi (4070), and it is joined to the preceding hadith, except that this version is mursal. These three men whom Salim named in his hadith had in fact embraced Islam on the day of the Conquest, and this, as Ibn Hajar noted, may well be the reason behind the revelation of this verse.