Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Jun 23, 2023
1 parent c593435 commit 4ae982e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ BaseException_add_note(PyObject *self, PyObject *note)
if (_PyObject_LookupAttr(self, &_Py_ID(__notes__), &notes) < 0) {
return NULL;
}
if (!notes) {
if (notes == NULL) {
notes = PyList_New(0);
if (notes == NULL) {
return NULL;
Expand All @@ -221,7 +221,7 @@ BaseException_add_note(PyObject *self, PyObject *note)
return NULL;
}
}
if (!PyList_Check(notes)) {
else if (!PyList_Check(notes)) {
Py_DECREF(notes);
PyErr_SetString(PyExc_TypeError, "Cannot add note: __notes__ is not a list");
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,10 @@ print_exception_notes(struct exception_print_context *ctx, PyObject *value)
res = PyFile_WriteObject(s, f, Py_PRINT_RAW);
Py_DECREF(s);
}
Py_DECREF(notes);
if (PyFile_WriteString("\n", f) < 0) {
res = -1;
}
Py_DECREF(notes);
return res;
}
Py_ssize_t num_notes = PySequence_Length(notes);
Expand Down

0 comments on commit 4ae982e

Please sign in to comment.