diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-23 13:57:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 13:57:50 (GMT) |
commit | 81f7359f67a7166d57a10a3d5366406d9c85f1de (patch) | |
tree | f72a35747fa77ab9c63ba70ef9e1620daddf0cc3 /Modules/_struct.c | |
parent | 5d9183c7ad68eb9ddb53d54a3f9a27e29dbabf31 (diff) | |
download | cpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.zip cpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.tar.gz cpython-81f7359f67a7166d57a10a3d5366406d9c85f1de.tar.bz2 |
gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)
Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index 2f2eb25..c960b81 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2164,8 +2164,7 @@ cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr) _structmodulestate *state = get_struct_state(module); if (fmt == NULL) { - Py_DECREF(*ptr); - *ptr = NULL; + Py_SETREF(*ptr, NULL); return 1; } |