mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-99300: Use Py_NewRef() in Modules/ directory (#99466)
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
db115682bd
commit
3817607b8a
10 changed files with 106 additions and 214 deletions
|
@ -176,8 +176,7 @@ get_char_or_None(Py_UCS4 c)
|
|||
static PyObject *
|
||||
Dialect_get_lineterminator(DialectObj *self, void *Py_UNUSED(ignored))
|
||||
{
|
||||
Py_XINCREF(self->lineterminator);
|
||||
return self->lineterminator;
|
||||
return Py_XNewRef(self->lineterminator);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -316,8 +315,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt)
|
|||
else {
|
||||
if (PyUnicode_READY(src) == -1)
|
||||
return -1;
|
||||
Py_INCREF(src);
|
||||
Py_XSETREF(*target, src);
|
||||
Py_XSETREF(*target, Py_NewRef(src));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -514,8 +512,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = (PyObject *)self;
|
||||
Py_INCREF(self);
|
||||
ret = Py_NewRef(self);
|
||||
err:
|
||||
Py_CLEAR(self);
|
||||
Py_CLEAR(dialect);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue