Death sentence against a pregnant woman

I am a first-year law student currently studying criminal law Can the Court pronounce death sentence against a pregnant woman? Would that not be inhumane?
TP, Dodoma

According to section 26(1) of the Penal Code, where a woman convicted of an offence punishable with death is alleged to be pregnant, the Court shall order that she be examined by a medical practitioner to establish the pregnancy. If it is proved to the satisfaction of the Court that she is pregnant, the Court shall sentence her to life imprisonment instead of suffering death by hanging.

Likewise, if the offender was below the age of 18 years at the time of committing the crime punishable with death, the Court instead of sentencing her/him to suffer death by hanging, shall order that the offender be detained at the President’s pleasure until such time when President will order otherwise.