Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,6 @@ The :c:type:`PyLongWriter` API can be used to import an integer.

Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`.

*writer* must not be ``NULL``.
If *writer* is ``NULL``, no operation is performed.

The writer instance and the *digits* array are invalid after the call.
4 changes: 4 additions & 0 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6953,6 +6953,10 @@ PyLongWriter_Create(int negative, Py_ssize_t ndigits, void **digits)
void
PyLongWriter_Discard(PyLongWriter *writer)
{
if (writer == NULL) {
return;
}

PyLongObject *obj = (PyLongObject *)writer;
assert(Py_REFCNT(obj) == 1);
Py_DECREF(obj);
Expand Down
Loading