Mishkat al-Masabih #1684
Funerals
The Arabic includes the chain of narration (sanad) and the collector's commentary; the English translation shows the Prophet's words only.
وَعَنْ أَبِي هُرَيْرَةَ: أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم لعن زوارات الْقُبُورِ. رَوَاهُ أَحْمَدُ وَالتِّرْمِذِيُّ وَابْنُ مَاجَهْ وَقَالَ التِّرْمِذِيُّ هَذَا حَدِيثٌ حَسَنٌ صَحِيح
وَقَالَ: قَدْ رَأَى بَعْضُ أَهْلِ الْعِلْمِ أَنَّ هَذَا كَانَ قبل أَن يرخص النَّبِي فِي زِيَارَةِ الْقُبُورِ فَلَمَّا رَخَّصَ دَخَلَ فِي رُخْصَتِهِ الرِّجَالُ وَالنِّسَاءُ. وَقَالَ بَعْضُهُمْ: إِنَّمَا كَرِهَ زِيَارَةَ الْقُبُورِ لِلنِّسَاءِ لِقِلَّةِ صَبْرِهِنَّ وَكَثْرَةِ جَزَعِهِنَّ. تمّ كَلَامه
Abu Huraira said God's messenger cursed women who visited graves.
Ahmad, Tirmidhi and Ibn Majah transmitted it, Tirmidhi saying this is a hasan sahih tradition. He added that some learned men consider this was before the Prophet gave licence to visit graves, and when he gave it both men and women were included. But some hold that he disapproved of women visiting graves because of the small amount of self-control they possess and their tendency to be greatly upset. The quotation from him ends here.
About Mishkat al-Masabih
This hadith is #1684 from Mishkat al-Masabih, in the Book of Funerals.