The Rosenbergs -- who sold the U.S. atomic bomb secrets to the Soviet Union -- weren't even charged with treason.
A charge of treason can only be made when the foreign nation is legally at war with the U.S. That's why the last person charged with treason in the U.S. was some Japanese-American dude who had gone to fight for the Japanese in World War II and was prosecuted in the early 1950s after he returned to the U.S.
And note that no one has been executed for treason since the Civil War.
Even making sedition charges stick is very rare, and usually employed against ‘white supremacists’ or similar.