The state Senate on Monday unanimously endorsed legislation by Sen. Noreen Evans that would close a loophole in a law crafted in the 1870s that led to a Southern California man's rape conviction being overturned.

The bill now heads to the Assembly. If passed and signed by the governor, the legislation would go into effect immediately on an urgency basis.

The bill addresses a ruling by the Los Angeles-based 2nd District Court of Appeal, which concluded Julio Morales hadn't raped an 18-year-old because the victim was not married.

In 2009, Morales pretended to be the teen's boyfriend in order to have sex with her while she was sleeping, according to Evans, D-Santa Rosa.

Under a state law dating back to the 1870s, a person who gets consent for sex by pretending to be someone else is only guilty of rape if the victim is married and the attacker is impersonating the spouse.

Evans' bill, SB 59, would amend the law by exchanging the word "spouse" for the term "sexual partner."