Browse Source

Issue #26182: Fix ia refleak in code that raises DeprecationWarning.

pull/9921/head
Yury Selivanov 10 years ago
parent
commit
1a9d687a49
  1. 2
      Misc/NEWS
  2. 8
      Python/ast.c

2
Misc/NEWS

@ -18,6 +18,8 @@ Core and Builtins
should result in PendingDeprecationWarning in 3.5 and in
DeprecationWarning in 3.6.
- Issue #26182: Fix ia refleak in code that raises DeprecationWarning.
Library
-------

8
Python/ast.c

@ -944,17 +944,19 @@ forbidden_name(struct compiling *c, identifier name, const node *n,
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;
}
}

Loading…
Cancel
Save