summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2016-12-16 16:04:25 -0500
committerNed Deily <nad@python.org>2016-12-16 16:04:25 -0500
commit3010e3c98be77771c5c02d7fb837f89082a778f7 (patch)
tree4e6d25e8a0b66833e5ff5c5c8eea9aa02ea1d21c /Python/errors.c
parent0cc235b9c8a2c540796c5cf4c59ab81ae15c61f1 (diff)
parent40ed436163059ecdbe4645eb7cb37bf0c9b1dd09 (diff)
downloadcpython-3010e3c98be77771c5c02d7fb837f89082a778f7.tar.gz
null merge additional 3.6.0rc1+ cherrypicks
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 7b25a2202c..fd6c42fd27 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -1059,16 +1059,15 @@ PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset)
PyErr_Clear();
Py_DECREF(tmp);
}
+ tmp = NULL;
if (col_offset >= 0) {
tmp = PyLong_FromLong(col_offset);
if (tmp == NULL)
PyErr_Clear();
- else {
- if (_PyObject_SetAttrId(v, &PyId_offset, tmp))
- PyErr_Clear();
- Py_DECREF(tmp);
- }
}
+ if (_PyObject_SetAttrId(v, &PyId_offset, tmp ? tmp : Py_None))
+ PyErr_Clear();
+ Py_XDECREF(tmp);
if (filename != NULL) {
if (_PyObject_SetAttrId(v, &PyId_filename, filename))
PyErr_Clear();
@@ -1080,9 +1079,6 @@ PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset)
Py_DECREF(tmp);
}
}
- if (_PyObject_SetAttrId(v, &PyId_offset, Py_None)) {
- PyErr_Clear();
- }
if (exc != PyExc_SyntaxError) {
if (!_PyObject_HasAttrId(v, &PyId_msg)) {
tmp = PyObject_Str(v);