A public offense may not be compromised, nor may any proceeding for the prosecution or punishment of a public offense, upon a compromise, be stayed except as is provided in section 29-01-16 and 29-01-17.