California Penal Code
An appeal may be taken from a judgment or order, in an infraction or misdemeanor case, to the appellate division of the superior court of the county in which the court from which the appeal is taken is located, in the following cases:
(1) By the people:
(A) From an order recusing the district attorney or city attorney pursuant to Section 1424.
(B) From an order or judgment dismissing or otherwise terminating all or any portion of the action, including such an order or judgment, entered after a verdict or finding of guilty or a verdict or judgment entered before the defendant has been placed in jeopardy or where the defendant has waived jeopardy.
(C) From sustaining a demurrer to any portion of the complaint or pleading.
(D) From an order granting a new trial.
(E) From an order arresting judgment.
(F) From any order made after judgment affecting the substantial rights of the people.
(G) From the imposition of an unlawful sentence, whether or not the court suspends the execution of sentence. As used in this subparagraph, "unlawful sentence" means the imposition of a sentence not authorized by law or the imposition of a sentence based upon an unlawful order of the court that strikes or otherwise modifies the effect of an enhancement or prior conviction. A defendant shall have the right to counsel in the people's appeal of an unlawful sentence under the same circumstances that he or she would have a right to counsel under subdivision (a) of Section 1238.
(H) Nothing in this section shall be construed to authorize an appeal from an order granting probation. Instead, the people may seek appellate review of any grant of probation, whether or not the court imposes sentence, by means of a petition for a writ of mandate or prohibition that is filed within 60 days after probation is granted. The review of any grant of probation shall include review of any order underlying the grant of probation.
(2) By the defendant:
(A) From a final judgment of conviction. A sentence, an order granting probation, a conviction in a case in which before final judgment the defendant is committed for insanity or is given an indeterminate commitment as a mentally disordered sex offender, or the conviction of a defendant committed for controlled substance addiction shall be deemed to be a final judgment within the meaning of this section. Upon appeal from a final judgment or an order granting probation the court may review any order denying a motion for a new trial.
(B) From any order made after judgment affecting his or her substantial rights.
An appeal from a judgment of conviction does not stay the execution of the judgment in any case unless the trial or a reviewing court shall so order. The granting or refusal of such an order shall rest in the discretion of the court, except that a court shall not stay any duty to register as a sex offender pursuant to Section 290.
Appeals to the appellate divisions of superior courts shall be taken, heard and determined, the decisions thereon shall be remitted to the courts from which the appeals are taken, and the records on such appeals shall be made up and filed in such time and manner as shall be prescribed in rules adopted by the Judicial Council.
Upon appeal by the people the reviewing court may review any question of law involved in any ruling affecting the judgment or order appealed from, without exception having been taken in the trial court. Upon an appeal by a defendant the court may, without exception having been taken in the trial court, review any question of law involved in any ruling, order, instruction, or thing whatsoever said or done at the trial or prior to or after judgment, which thing was said or done after objection made in and considered by the trial court and which affected the substantial rights of the defendant. The court may also review any instruction given, refused or modified, even though no objection was made thereto in the trial court if the substantial rights of the defendant were affected thereby. The reviewing court may reverse, affirm or modify the judgment or order appealed from, and may set aside, affirm or modify any or all of the proceedings subsequent to, or dependent upon, such judgment or order, and may, if proper, order a new trial. If a new trial is ordered upon appeal, it must be had in the court from which the appeal is taken.