comparison mercurial/parsers.c @ 30103:74cd33c9be76

parsers: use PyVarObject_HEAD_INIT The macro changed slightly in Python 3, introducing curly brackets that somehow confuse Clang into issuing a ton of compiler warnings. Using PyVarObject_HEAD_INIT makes these go away. It's worth noting that the code is identical: the 2nd argument to PyVarObject_HEAD_INIT is assigned to the ob_size field and is inserted immediately after "PyObject_HEAD_INIT(type)" is generated. Compilers are weird.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 08 Oct 2016 22:44:02 +0200
parents c5afe5531709
children 9b6ff0f940ed
comparison
equal deleted inserted replaced
30102:a8c948ee3668 30103:74cd33c9be76
2514 {"nodemap", (getter)index_nodemap, NULL, "nodemap", NULL}, 2514 {"nodemap", (getter)index_nodemap, NULL, "nodemap", NULL},
2515 {NULL} /* Sentinel */ 2515 {NULL} /* Sentinel */
2516 }; 2516 };
2517 2517
2518 static PyTypeObject indexType = { 2518 static PyTypeObject indexType = {
2519 PyObject_HEAD_INIT(NULL) 2519 PyVarObject_HEAD_INIT(NULL, 0)
2520 0, /* ob_size */
2521 "parsers.index", /* tp_name */ 2520 "parsers.index", /* tp_name */
2522 sizeof(indexObject), /* tp_basicsize */ 2521 sizeof(indexObject), /* tp_basicsize */
2523 0, /* tp_itemsize */ 2522 0, /* tp_itemsize */
2524 (destructor)index_dealloc, /* tp_dealloc */ 2523 (destructor)index_dealloc, /* tp_dealloc */
2525 0, /* tp_print */ 2524 0, /* tp_print */