FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-102471: Change PyLongWriter_Discard(NULL) to do nothing by vstinner · Pull Request #129339 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion Doc/c-api/long.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL