There are narrations on this topic from Buraidah and Rabah - and they say he was Riyah - bin Ar-Rabi', Al-Aswad bin Sari', Ibn 'Abbas, and As-Sa'b bin Jaththamah.
[Abu 'Eisa said:] This Hadith is Hasan Sahih. This is acted upon according to some of the people of knowledge among the Companions of the Prophet (ﷺ) and others. They disliked killing women and children. This is the view of Sufyan Ath-Thawri and Ash-Shafi'i.
Some of the people of knowledge made an exception for killing the women who had children with them during night attacks, this is the view of Ahmad and Ishaq, they permitted it in night attacks.
In-book : Book 21, Hadith 30
English translation : Vol. 3, Book 19, Hadith 1569