mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
gh-99300: Use Py_NewRef() in Modules/ directory (#99467)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
This commit is contained in:
parent
3817607b8a
commit
7e4dec02ac
10 changed files with 75 additions and 144 deletions
|
|
@ -481,8 +481,7 @@ buffered_close(buffered *self, PyObject *args)
|
|||
if (r < 0)
|
||||
goto end;
|
||||
if (r > 0) {
|
||||
res = Py_None;
|
||||
Py_INCREF(res);
|
||||
res = Py_NewRef(Py_None);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
@ -1007,8 +1006,7 @@ _buffered_readinto_generic(buffered *self, Py_buffer *buffer, char readinto1)
|
|||
break;
|
||||
if (n < 0) {
|
||||
if (n == -2) {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
res = Py_NewRef(Py_None);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -1422,8 +1420,7 @@ _io_BufferedReader___init___impl(buffered *self, PyObject *raw,
|
|||
if (_PyIOBase_check_readable(raw, Py_True) == NULL)
|
||||
return -1;
|
||||
|
||||
Py_INCREF(raw);
|
||||
Py_XSETREF(self->raw, raw);
|
||||
Py_XSETREF(self->raw, Py_NewRef(raw));
|
||||
self->buffer_size = buffer_size;
|
||||
self->readable = 1;
|
||||
self->writable = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue