python: Fix crash during auto-indentation