It was a scene straight out of the 1950s, but the year was 2017. Travis Allen, a Republican from southern California, took to the floor of the state assembly on 8 May to denounce communism. “To allow subversives and avowed communists to now work for the state of California,” he railed, “is a direct insult to the people of California who pay for that government.”

Allen was speaking out against a move to remove language from the California code that that bars members of the Communist party from holding government jobs in the state.

Anti-communist language remains on the books in several states, and in California, at least, it’s not going anywhere. After facing backlash from Republicans, veterans and the Vietnamese American community, the bill’s sponsor, the Democratic assemblyman Rob Bonta, announced last week that he would not move forward with the bill.

“I’ve been called a commie. I’ve been told to go back to China. I’ve had death threats,” Bonta told the Guardian. He described as “ironic and curious” the fact that one of his Republican opponents was “wrapping himself in the flag” while “supporting a law that blatantly violates our first amendment rights”, but said he respected the emotions that the issue had raised for refugees from communist regimes.

With intrigue about Russia driving the daily news cycle, cold war sentiments are bubbling up again, despite the fact that our erstwhile adversary is decidedly capitalist these days. It’s a marked reversal from just a year ago, when an astonishing number of Americans embraced the candidacy of a self-identified socialist, and a reminder of how deep anti-communist suspicion runs through the American psyche.

Bonta is not the first legislator to fail in an attempt to drag state laws into the 21st century. A similar effort was made in California in 2008, when a bill passed only to be vetoed by the then governor, Arnold Schwarzenegger. “I see no compelling reason to change the law that maintains our responsibility to ensure that public resources are not used for purposes of overthrowing the US or state government, or for communist activities,” the governor wrote in his veto statement.

Joe Fitzgibbon, a Democratic state representative in Washington, has attempted three times since 2012 to pass legislation getting rid of his state’s law barring communists from voting or having government jobs, but he has faced considerable opposition from Republicans.

He called the law “a mark of shame for Washington state” in a recent interview with the Guardian, and said he would keep trying.

“I wonder if now that Republicans have a different opinion on Russia, if maybe they’ll be more receptive,” he said. “My hope is that they will change their tune on whether people should be discriminated against for their political beliefs. Maybe they can talk to their Russian friends about that.”

Lest there be any misunderstanding: members of the Communist party are currently allowed to hold government jobs in every American state. Such laws were passed around the country during the so-called red scare of the 20th century, but they have long since been ruled unconstitutional by the supreme court.

Some states have managed to move on. Arizona lawmakers voted in 2003 to update the state’s loyalty oath. Now, instead of swearing they are not members of of the Communist party, elected officials and public employees must vow not to be terrorists. Candidates for elected office in Illinois still receive a loyalty oath when they register to run, but filling it out is optional. Pennsylvania stopped requiring candidates to sign a loyalty oath in 2006, after a Socialist Worker party candidate objected.

While these red scare relics can seem comical, Michael Risher of the American Civil Liberties Union of Northern California said they could still have serious consequences. “Occasionally someone will dredge them up and use them to try to scare people … to stop them from speaking out,” he said.

In 2006, he recalled, a California legislator asked the state attorney general whether an anti-subversive law could be used to go after Mexican American student activists. At the time, there was considerable rightwing suspicion about the student group MEChA (Movimiento Estudiantil Chicanx de Aztlán) and its supposed goal of reconquista, or returning California and other parts of the south-west to Mexico.

“The danger is not so much that someone will be sentenced to life in prison, but that they will be restrained from doing something that they would otherwise do,” Risher said.

In New York City, a public school principal has been placed under investigation over allegations of recruiting students to join the Progressive Labor party, a communist group. The principal, Jill Bloomberg, is an outspoken critic of racial inequality in the school system, and she has sued the city’s department of education for violating her civil rights.

Bloomberg accused the school district of using “a tactic that people have used for years to discredit very, very legitimate anti-racist fight back: to cast it as communism, as if that automatically discredits it”. She is not a member of the communist group, she said, “but if I were, it would not be illegal or a violation of the school’s regulation”.

Either way, she said the investigation had placed a pall over her school, as teachers second-guess their ability to speak freely to their students. “If you’re teaching the Harlem renaissance and the civil rights movement, can you say Paul Robeson was proud to be a member of the Communist party?” she asked. “Or can you only talk about communism if you present it as a negative?”

For Rossana Cambron, a national vice-chair of the Communist Party USA, which has about 5,000 members, the failure of Bonta’s bill was “very disappointing”. Still, she said, such efforts are in no way a priority.

“We’re too busy fighting Trump to be looking into those kind of things.”