diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:41:58 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 13:41:58 (GMT) |
| commit | 2e6c8296817a8476cdb4c3c6ce6d79304379a4d7 (patch) | |
| tree | b72997107e4fafd6aa8fdfef95dfe2c3d7b2d035 /Objects/exceptions.c | |
| parent | 8688acaf2ef4f355725bf4d5bf024fed99752061 (diff) | |
| download | cpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.zip cpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.tar.gz cpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.tar.bz2 | |
Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
Diffstat (limited to 'Objects/exceptions.c')
| -rw-r--r-- | Objects/exceptions.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 8edc6c6..8f2c7a6 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -517,12 +517,14 @@ SystemExit_init(PySystemExitObject *self, PyObject *args, PyObject *kwds) if (size == 0) return 0; - Py_CLEAR(self->code); - if (size == 1) - self->code = PyTuple_GET_ITEM(args, 0); - else if (size > 1) - self->code = args; - Py_INCREF(self->code); + if (size == 1) { + Py_INCREF(PyTuple_GET_ITEM(args, 0)); + Py_SETREF(self->code, PyTuple_GET_ITEM(args, 0)); + } + else { /* size > 1 */ + Py_INCREF(args); + Py_SETREF(self->code, args); + } return 0; } |
