Born to a prosperous land-owning family, Yang studied politics at Shanghai University and Marxist philosophy and revolutionary tactics at Moscow Sun Yat-sen University. He went on to hold high office under both Mao Zedong and later Deng Xiaoping; from 1945 to 1965 he was Director of the General Office and from 1945 to 1956 Secretary–General of the Central Military Commission (CMC). In these positions, Yang oversaw much of the day-to-day running of government and Party affairs, both political and military, amassing a great deal of bureaucratic power by controlling things like the flow of documents, the keeping of records, and the approval and allocation of funds. Purged, arrested and imprisoned during the Cultural Revolution, he spent 12 years in prison but staged a comeback in 1978, becoming a key ally of Deng, serving as Mayor of Guangzhou (1979–81), and returning to the CMC as Secretary–General and also Vice Chairman (1981–89), before assuming the Presidency.