New submission from Yury Selivanov: A simple way of reproducing the issue is to try to compile the following piece of code with refleaks check mode on:
def foo(a:(yield)): pass Since '(yield)' expression is outside of a function, it will trigger a SyntaxError. There is a subtle bug in compile.c though, specifically in compiler_visit_argannotation method; it should return -1 in case of error, but the VISIT macro it uses returns 0 on errors. Attached patch uses 'compiler_visit_expr' directly returning correct error code. ---------- components: Interpreter Core files: compile.patch keywords: patch messages: 247153 nosy: benjamin.peterson, ncoghlan, yselivanov priority: high severity: normal stage: patch review status: open title: refleak on SyntaxError in function parameter annotation versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file39985/compile.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24687> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com