Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c019158

Browse files
Issue #27703: Got rid of unnecessary NULL checks in do_raise() in release mode.
Patch by Xiang Zhang.
1 parent 2f63fae commit c019158

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Python/ceval.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4245,6 +4245,9 @@ do_raise(PyObject *exc, PyObject *cause)
42454245
goto raise_error;
42464246
}
42474247

4248+
assert(type != NULL);
4249+
assert(value != NULL);
4250+
42484251
if (cause) {
42494252
PyObject *fixed_cause;
42504253
if (PyExceptionClass_Check(cause)) {
@@ -4271,8 +4274,8 @@ do_raise(PyObject *exc, PyObject *cause)
42714274

42724275
PyErr_SetObject(type, value);
42734276
/* PyErr_SetObject incref's its arguments */
4274-
Py_XDECREF(value);
4275-
Py_XDECREF(type);
4277+
Py_DECREF(value);
4278+
Py_DECREF(type);
42764279
return 0;
42774280

42784281
raise_error:

0 commit comments

Comments
 (0)