Patchwork [2,of,6] manifest: use PyVarObject_HEAD_INIT

login
register
mail settings
Submitter Gregory Szorc
Date Oct. 13, 2016, 7:44 p.m.
Message ID <1e3d29ee42903dfb6530.1476387854@gps-mbp.local>
Download mbox | patch
Permalink /patch/17060/
State Accepted
Headers show

Comments

Gregory Szorc - Oct. 13, 2016, 7:44 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1476357443 -7200
#      Thu Oct 13 13:17:23 2016 +0200
# Node ID 1e3d29ee42903dfb65308a849f987dbe9de97953
# Parent  1f30bcebd4bdc26602ec4e9ae924f101c7642594
manifest: use PyVarObject_HEAD_INIT

More appeasing the Python 3 and compiler overlords. The code is
equivalent.

Patch

diff --git a/mercurial/manifest.c b/mercurial/manifest.c
--- a/mercurial/manifest.c
+++ b/mercurial/manifest.c
@@ -261,10 +261,9 @@  done:
 	| Py_TPFLAGS_HAVE_ITER
 #endif
 
 static PyTypeObject lazymanifestEntriesIterator = {
-	PyObject_HEAD_INIT(NULL)
-	0,                               /*ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"parsers.lazymanifest.entriesiterator", /*tp_name */
 	sizeof(lmIter),                  /*tp_basicsize */
 	0,                               /*tp_itemsize */
 	lmiter_dealloc,                  /*tp_dealloc */
@@ -310,10 +309,9 @@  static PyObject *lmiter_iterkeysnext(PyO
 	| Py_TPFLAGS_HAVE_ITER
 #endif
 
 static PyTypeObject lazymanifestKeysIterator = {
-	PyObject_HEAD_INIT(NULL)
-	0,                               /*ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"parsers.lazymanifest.keysiterator", /*tp_name */
 	sizeof(lmIter),                  /*tp_basicsize */
 	0,                               /*tp_itemsize */
 	lmiter_dealloc,                  /*tp_dealloc */
@@ -889,10 +887,9 @@  static PyMethodDef lazymanifest_methods[
 #define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_SEQUENCE_IN
 #endif
 
 static PyTypeObject lazymanifestType = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                                /* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"parsers.lazymanifest",                           /* tp_name */
 	sizeof(lazymanifest),                             /* tp_basicsize */
 	0,                                                /* tp_itemsize */
 	(destructor)lazymanifest_dealloc,                 /* tp_dealloc */