Generalize type object initialization to work with both Python 2.* and Python 3.*
The layout of PyVarObject changed between python 2 and python 3, and this leads to the existing code for all of the various PyTypeObject initializers failing to compile with python 3 Change the way we initialize these structs to use PyVarObject_HEAD_INIT directly, rather than merely PyObject_HEAD_INIT, so that it compiles cleanly with both major versions of Python
This commit is contained in:
parent
2f5a5c44cf
commit
4b8e0ebde6
|
@ -502,8 +502,7 @@ static char hdr_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject hdr_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.hdr", /* tp_name */
|
||||
sizeof(hdrObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -452,8 +452,7 @@ static char rpmds_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmds_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.ds", /* tp_name */
|
||||
sizeof(rpmdsObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -285,8 +285,7 @@ static PyGetSetDef rpmfd_getseters[] = {
|
|||
};
|
||||
|
||||
PyTypeObject rpmfd_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.fd", /* tp_name */
|
||||
sizeof(rpmfdObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -316,8 +316,7 @@ static char rpmfi_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmfi_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.fi", /* tp_name */
|
||||
sizeof(rpmfiObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -51,8 +51,7 @@ static struct PyMethodDef rpmPubkey_methods[] = {
|
|||
static char rpmPubkey_doc[] = "";
|
||||
|
||||
PyTypeObject rpmPubkey_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.pubkey", /* tp_name */
|
||||
sizeof(rpmPubkeyObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
@ -133,8 +132,7 @@ static char rpmKeyring_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmKeyring_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.keyring", /* tp_name */
|
||||
sizeof(rpmKeyringObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -146,8 +146,7 @@ static char rpmmi_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmmi_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.mi", /* tp_name */
|
||||
sizeof(rpmmiObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -74,8 +74,7 @@ static PyObject *rpmprob_str(rpmProblemObject *s)
|
|||
}
|
||||
|
||||
PyTypeObject rpmProblem_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.prob", /* tp_name */
|
||||
sizeof(rpmProblemObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
|
@ -230,8 +229,7 @@ static char rpmps_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmps_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.ps", /* tp_name */
|
||||
sizeof(rpmpsObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -157,8 +157,7 @@ static PyGetSetDef rpmtd_getseters[] = {
|
|||
};
|
||||
|
||||
PyTypeObject rpmtd_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.td", /* tp_name */
|
||||
sizeof(rpmtdObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -266,8 +266,7 @@ static char rpmte_doc[] =
|
|||
"";
|
||||
|
||||
PyTypeObject rpmte_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.te", /* tp_name */
|
||||
sizeof(rpmteObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -813,8 +813,7 @@ static PyGetSetDef rpmts_getseters[] = {
|
|||
};
|
||||
|
||||
PyTypeObject rpmts_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /* ob_size */
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.ts", /* tp_name */
|
||||
sizeof(rpmtsObject), /* tp_size */
|
||||
0, /* tp_itemsize */
|
||||
|
|
|
@ -176,8 +176,7 @@ static PyObject *spec_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
PyTypeObject spec_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"rpm.spec", /*tp_name*/
|
||||
sizeof(specObject), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
|
|
Loading…
Reference in New Issue