diff options
| author | Victor Stinner <vstinner@python.org> | 2022-11-16 18:34:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 18:34:24 +0100 |
| commit | 8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b (patch) | |
| tree | 510409237622aa30dfc6833602bdde97c578f2bb /Objects/genobject.c | |
| parent | 19c1462e8dca3319c8290e2edcce482bd18cb018 (diff) | |
| download | cpython-git-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.gz | |
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().
Diffstat (limited to 'Objects/genobject.c')
| -rw-r--r-- | Objects/genobject.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 3e0e075097..6661e3fb94 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -341,8 +341,7 @@ _PyGen_yf(PyGenObject *gen) /* Not in a yield from */ return NULL; } - yf = _PyFrame_StackPeek(frame); - Py_INCREF(yf); + yf = Py_NewRef(_PyFrame_StackPeek(frame)); } return yf; @@ -494,8 +493,7 @@ throw_here: /* Normalize to raise <class>, <instance> */ Py_XDECREF(val); val = typ; - typ = PyExceptionInstance_Class(typ); - Py_INCREF(typ); + typ = Py_NewRef(PyExceptionInstance_Class(typ)); if (tb == NULL) /* Returns NULL if there's no traceback */ |
