mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
gh-99300: Use Py_NewRef() in Objects/ directory (#99354)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Objects/ directory.
This commit is contained in:
parent
1960eb005e
commit
3a1dde8f29
13 changed files with 66 additions and 128 deletions
|
@ -1042,8 +1042,7 @@ formatteriter_next(formatteriterobject *it)
|
|||
otherwise create a one length string with the conversion
|
||||
character */
|
||||
if (conversion == '\0') {
|
||||
conversion_str = Py_None;
|
||||
Py_INCREF(conversion_str);
|
||||
conversion_str = Py_NewRef(Py_None);
|
||||
}
|
||||
else
|
||||
conversion_str = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND,
|
||||
|
@ -1121,8 +1120,7 @@ formatter_parser(PyObject *ignored, PyObject *self)
|
|||
return NULL;
|
||||
|
||||
/* take ownership, give the object to the iterator */
|
||||
Py_INCREF(self);
|
||||
it->str = self;
|
||||
it->str = Py_NewRef(self);
|
||||
|
||||
/* initialize the contained MarkupIterator */
|
||||
MarkupIterator_init(&it->it_markup, (PyObject*)self, 0, PyUnicode_GET_LENGTH(self));
|
||||
|
@ -1265,8 +1263,7 @@ formatter_field_name_split(PyObject *ignored, PyObject *self)
|
|||
|
||||
/* take ownership, give the object to the iterator. this is
|
||||
just to keep the field_name alive */
|
||||
Py_INCREF(self);
|
||||
it->str = self;
|
||||
it->str = Py_NewRef(self);
|
||||
|
||||
/* Pass in auto_number = NULL. We'll return an empty string for
|
||||
first_obj in that case. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue