summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c
index fcd1563a69..bfae6ed7d4 100644
--- a/Python/ast.c
+++ b/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;
}
}