South African stocks posted gains in November, outperforming emerging market peers, largely because the Johannesburg market avoided the brunt of the severe volatility in the artificial intelligence (AI) sector.