[New-bugs-announce] [issue24687] refleak on SyntaxError in function parameter annotation

Yury Selivanov report at bugs.python.org
Thu Jul 23 00:09:17 CEST 2015

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list