gh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)

It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.
This commit is contained in:
Victor Stinner 2025-01-27 11:51:16 +01:00 committed by GitHub
parent 11148e91e3
commit 7ec17429d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -6953,6 +6953,10 @@ error:
void
PyLongWriter_Discard(PyLongWriter *writer)
{
if (writer == NULL) {
return;
}
PyLongObject *obj = (PyLongObject *)writer;
assert(Py_REFCNT(obj) == 1);
Py_DECREF(obj);