Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-99300: Use Py_NewRef() in PC/ directory
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the PC/ directory.
  • Loading branch information
vstinner committed Nov 14, 2022
commit 897dfe950d05b80802f1385a85d5a3665ebfbac4
3 changes: 1 addition & 2 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,7 @@ _msi_SummaryInformation_GetProperty_impl(msiobj *self, int field)
result = PyBytes_FromStringAndSize(sval, ssize);
break;
case VT_EMPTY:
Py_INCREF(Py_None);
result = Py_None;
result = Py_NewRef(Py_None);
break;
default:
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
Expand Down
6 changes: 2 additions & 4 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ static PyHKEYObject *
winreg_HKEYType___enter___impl(PyHKEYObject *self)
/*[clinic end generated code: output=52c34986dab28990 input=c40fab1f0690a8e2]*/
{
Py_XINCREF(self);
return self;
return Py_XNewRef(self);
}


Expand Down Expand Up @@ -784,8 +783,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
support it natively, we should handle the bits. */
default:
if (retDataSize == 0) {
Py_INCREF(Py_None);
obData = Py_None;
obData = Py_NewRef(Py_None);
}
else
obData = PyBytes_FromStringAndSize(
Expand Down