changeset: 104987:7a996e826f83 branch: 3.6 parent: 104985:f7308820bb7a user: Yury Selivanov date: Tue Nov 08 16:54:18 2016 -0500 files: Misc/NEWS Python/ast.c description: Issue #26182: Fix ia refleak in code that raises DeprecationWarning. diff -r f7308820bb7a -r 7a996e826f83 Misc/NEWS --- a/Misc/NEWS Tue Nov 08 23:13:36 2016 +0200 +++ b/Misc/NEWS Tue Nov 08 16:54:18 2016 -0500 @@ -18,6 +18,8 @@ should result in PendingDeprecationWarning in 3.5 and in DeprecationWarning in 3.6. +- Issue #26182: Fix ia refleak in code that raises DeprecationWarning. + Library ------- diff -r f7308820bb7a -r 7a996e826f83 Python/ast.c --- a/Python/ast.c Tue Nov 08 23:13:36 2016 +0200 +++ b/Python/ast.c Tue Nov 08 16:54:18 2016 -0500 @@ -944,17 +944,19 @@ PyObject *message = PyUnicode_FromString( "'async' and 'await' will become reserved keywords" " in Python 3.7"); + int ret; if (message == NULL) { return 1; } - if (PyErr_WarnExplicitObject( + ret = PyErr_WarnExplicitObject( PyExc_DeprecationWarning, message, c->c_filename, LINENO(n), NULL, - NULL) < 0) - { + NULL); + Py_DECREF(message); + if (ret < 0) { return 1; } }