Except that's not what the prosecutors agreed to. The prosecutors agreed to a 90 day evaluation and probation.
If they felt that wasn't good enough, then they should have never agreed to a plea. But the thing was, they did. So did the attorney's for the so-called victim. The only one who wanted Polanski to go to jail was this judge, who violated the ethics of canon by having ex-partie communications with people in the prosecutors office not involved in the case.
Cosby's conviction was thrown out because of prosecutorial misconduct. (In short, they promised him immunity from criminal prosecution to settle a civil lawsuit, and then used testimony in the civil lawsuit to go after him.)
I thought that case was a bit absurd, too. They essentially stood the law on its head to get this guy because he was a celebrity.
No, he was having an affair with a much younger woman... which clearly colored his thinking on the case.