Hadithcore
Mishkat al-Masabih, 1770

Abu Huraira said God's messenger cursed women who visited graves. Ahmad, Tirmidhi and Ibn Majah transmitted it, Tirmidhi saying this is a <i>hasan sahih</i> 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.

وَعَنْ أَبِي هُرَيْرَةَ: أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم لعن زوارات الْقُبُورِ. رَوَاهُ أَحْمَدُ وَالتِّرْمِذِيُّ وَابْنُ مَاجَهْ وَقَالَ التِّرْمِذِيُّ هَذَا حَدِيثٌ حَسَنٌ صَحِيح وَقَالَ: قَدْ رَأَى بَعْضُ أَهْلِ الْعِلْمِ أَنَّ هَذَا كَانَ قبل أَن يرخص النَّبِي فِي زِيَارَةِ الْقُبُورِ فَلَمَّا رَخَّصَ دَخَلَ فِي رُخْصَتِهِ الرِّجَالُ وَالنِّسَاءُ. وَقَالَ بَعْضُهُمْ: إِنَّمَا كَرِهَ زِيَارَةَ الْقُبُورِ لِلنِّسَاءِ لِقِلَّةِ صَبْرِهِنَّ وَكَثْرَةِ جَزَعِهِنَّ. تمّ كَلَامه

References1 variant
In-Book Reference
Book 5, Hadith 242