Jakarta: Extra marital sex, homelessness, criticism of the President and spreading communist ideology would all be crimes - and attract jail time - under looming sweeping changes to Indonesia's penal code.

Other mooted changes include making it illegal for couples who aren't married to live together, showing contraception to a minor (for example, displaying condoms in a shop), curbing access to abortion and criminalising criticism of a judge, fake news, bestiality and black magic.

Human rights groups fear President Joko Widodo will wave through the new penal code. Credit:AP

The Indonesian Parliament has been working to update the country's penal code since 1995. Much of the current code dates back to the era of Dutch colonialism, pre-World War II.

The current Parliament will finish sitting in a matter of weeks and a vote on the bill is due to take place on September 24, before the new slate of MPs elected in the April 17 elections take their seats in October.