Fix parser error detection in py3