Mercurial > hg
changeset 30079:84debea79903
manifest: drop Py_TPFLAGS_HAVE_SEQUENCE_IN from tp_flags in Python 3
This flag disappeared in Python 3. It is only necessary in Python 2,
apparently.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 08 Oct 2016 18:04:57 +0200 |
parents | 173bdb502503 |
children | 33e8a5a00007 |
files | mercurial/manifest.c |
diffstat | 1 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.c Sat Oct 08 05:26:58 2016 -0700 +++ b/mercurial/manifest.c Sat Oct 08 18:04:57 2016 +0200 @@ -254,6 +254,13 @@ return ret; } +#ifdef IS_PY3K +#define LAZYMANIFESTENTRIESITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT +#else +#define LAZYMANIFESTENTRIESITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT \ + | Py_TPFLAGS_HAVE_ITER +#endif + static PyTypeObject lazymanifestEntriesIterator = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -275,9 +282,7 @@ 0, /*tp_getattro */ 0, /*tp_setattro */ 0, /*tp_as_buffer */ - /* tp_flags: Py_TPFLAGS_HAVE_ITER tells python to - use tp_iter and tp_iternext fields. */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, + LAZYMANIFESTENTRIESITERATOR_TPFLAGS, /* tp_flags */ "Iterator for 3-tuples in a lazymanifest.", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -298,6 +303,13 @@ return PyString_FromStringAndSize(l->start, pl); } +#ifdef IS_PY3K +#define LAZYMANIFESTKEYSITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT +#else +#define LAZYMANIFESTKEYSITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT \ + | Py_TPFLAGS_HAVE_ITER +#endif + static PyTypeObject lazymanifestKeysIterator = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -319,9 +331,7 @@ 0, /*tp_getattro */ 0, /*tp_setattro */ 0, /*tp_as_buffer */ - /* tp_flags: Py_TPFLAGS_HAVE_ITER tells python to - use tp_iter and tp_iternext fields. */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, + LAZYMANIFESTKEYSITERATOR_TPFLAGS, /* tp_flags */ "Keys iterator for a lazymanifest.", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -873,6 +883,12 @@ {NULL}, }; +#ifdef IS_PY3K +#define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT +#else +#define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_SEQUENCE_IN +#endif + static PyTypeObject lazymanifestType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -894,7 +910,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_SEQUENCE_IN, /* tp_flags */ + LAZYMANIFEST_TPFLAGS, /* tp_flags */ "TODO(augie)", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */