But there WAS a death penalty, and it's very possible that David might have actually preferred being stoned to what happened instead.Note too that many of the punishments given in the Mosaic law [sic] were not "enforced". David was not stoned for sleeping with Bathsheba.
Likewise, His Torah specifies a death penalty for many abominations. Specifically so, in the case of a "man lying with a man as with a woman." Arguably, He still "enforces" it - with death at an early age. There are many similar examples, I might argue.