bpo-39573: Use the Py_TYPE() macro (GH-21433)

Replace obj->ob_type with Py_TYPE(obj).
This commit is contained in:
Victor Stinner 2020-07-10 12:40:38 +02:00 • committed by GitHub
parent d878349bac
commit 8182cc2e68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 12 deletions

View file

@ -193,7 +193,7 @@ static FNFCIGETNEXTCABINET(cb_getnextcabinet)
if (!PyBytes_Check(result)) {
PyErr_Format(PyExc_TypeError,
"Incorrect return type %s from getnextcabinet",
result->ob_type->tp_name);
Py_TYPE(result)->tp_name);
Py_DECREF(result);
return FALSE;
}
@ -879,7 +879,7 @@ _msi_View_Execute(msiobj *self, PyObject *oparams)
MSIHANDLE params = 0;
if (oparams != Py_None) {
if (oparams->ob_type != &record_Type) {
if (!Py_IS_TYPE(oparams, &record_Type)) {
PyErr_SetString(PyExc_TypeError, "Execute argument must be a record");
return NULL;
}
@ -955,7 +955,7 @@ _msi_View_Modify_impl(msiobj *self, int kind, PyObject *data)
{
int status;
if (data->ob_type != &record_Type) {
if (!Py_IS_TYPE(data, &record_Type)) {
PyErr_SetString(PyExc_TypeError, "Modify expects a record object");
return NULL;
}

View file

@ -112,7 +112,7 @@ typedef struct {
HKEY hkey;
} PyHKEYObject;
#define PyHKEY_Check(op) ((op)->ob_type == &PyHKEY_Type)
#define PyHKEY_Check(op) Py_IS_TYPE(op, &PyHKEY_Type)
static char *failMsg = "bad operand type";
@ -693,7 +693,7 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
PyErr_Format(PyExc_TypeError,
"Objects of type '%s' can not "
"be used as binary registry values",
value->ob_type->tp_name);
Py_TYPE(value)->tp_name);
return FALSE;
}