8000 gh-99300: Use Py_NewRef() in PC/ directory (#99479) · python/cpython@f5e326e · GitHub
[go: up one dir, main page]

Skip to content

Commit f5e326e

Browse files
authored
gh-99300: Use Py_NewRef() in PC/ directory (#99479)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the PC/ directory.
1 parent 1089bdc commit f5e326e

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

PC/_msi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,7 @@ _msi_SummaryInformation_GetProperty_impl(msiobj *self, int field)
701701
result = PyBytes_FromStringAndSize(sval, ssize);
702702
break;
703703
case VT_EMPTY:
704-
Py_INCREF(Py_None);
705-
result = Py_None;
704+
result = Py_NewRef(Py_None);
706705
break;
707706
default:
708707
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);

PC/winreg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ static PyHKEYObject *
308308
winreg_HKEYType___enter___impl(PyHKEYObject *self)
309309
/*[clinic end generated code: output=52c34986dab28990 input=c40fab1f0690a8e2]*/
310310
{
311-
Py_XINCREF(self);
312-
return self;
311+
return (PyHKEYObject*)Py_XNewRef(self);
313312
}
314313

315314

@@ -784,8 +783,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
784783
support it natively, we should handle the bits. */
785784
default:
786785
if (retDataSize == 0) {
787-
Py_INCREF(Py_None);
788-
obData = Py_None;
786+
obData = Py_NewRef(Py_None);
789787
}
790788
else
791789
obData = PyBytes_FromStringAndSize(

0 commit comments

Comments
 (0)
0