In cases involving cruel and unusual punishment (hanging, execution, etc.), or punishments with the intent of embarrassing or shaming the receiver, the court generally rules to prohibit most of these punishments (with the exception of cases involving murder(s)).
The Eighth Amendment of the Constitution prohibits the government of the United States of America from using cruel and/or unusual punishments on United States soil against any United States citizen.