Mercurial > hg
comparison mercurial/cext/manifest.c @ 48813:be3af7eb2bbb
cext: remove some conditional preprocessor defines
We may want to inline these defines. But for now, getting rid of the
Python 2 support is a step forward.
Differential Revision: https://phab.mercurial-scm.org/D12224
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 15:44:39 -0700 |
parents | 12450fbea288 |
children | b0dd39b91e7a |
comparison
equal
deleted
inserted
replaced
48812:9b0f173445d1 | 48813:be3af7eb2bbb |
---|---|
315 Py_XDECREF(hash); | 315 Py_XDECREF(hash); |
316 Py_XDECREF(flags); | 316 Py_XDECREF(flags); |
317 return ret; | 317 return ret; |
318 } | 318 } |
319 | 319 |
320 #ifdef IS_PY3K | |
321 #define LAZYMANIFESTENTRIESITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT | 320 #define LAZYMANIFESTENTRIESITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT |
322 #else | |
323 #define LAZYMANIFESTENTRIESITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT \ | |
324 | Py_TPFLAGS_HAVE_ITER | |
325 #endif | |
326 | 321 |
327 static PyTypeObject lazymanifestEntriesIterator = { | 322 static PyTypeObject lazymanifestEntriesIterator = { |
328 PyVarObject_HEAD_INIT(NULL, 0) /* header */ | 323 PyVarObject_HEAD_INIT(NULL, 0) /* header */ |
329 "parsers.lazymanifest.entriesiterator", /*tp_name */ | 324 "parsers.lazymanifest.entriesiterator", /*tp_name */ |
330 sizeof(lmIter), /*tp_basicsize */ | 325 sizeof(lmIter), /*tp_basicsize */ |
363 } | 358 } |
364 pl = pathlen(l); | 359 pl = pathlen(l); |
365 return PyBytes_FromStringAndSize(l->start, pl); | 360 return PyBytes_FromStringAndSize(l->start, pl); |
366 } | 361 } |
367 | 362 |
368 #ifdef IS_PY3K | |
369 #define LAZYMANIFESTKEYSITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT | 363 #define LAZYMANIFESTKEYSITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT |
370 #else | |
371 #define LAZYMANIFESTKEYSITERATOR_TPFLAGS Py_TPFLAGS_DEFAULT \ | |
372 | Py_TPFLAGS_HAVE_ITER | |
373 #endif | |
374 | 364 |
375 static PyTypeObject lazymanifestKeysIterator = { | 365 static PyTypeObject lazymanifestKeysIterator = { |
376 PyVarObject_HEAD_INIT(NULL, 0) /* header */ | 366 PyVarObject_HEAD_INIT(NULL, 0) /* header */ |
377 "parsers.lazymanifest.keysiterator", /*tp_name */ | 367 "parsers.lazymanifest.keysiterator", /*tp_name */ |
378 sizeof(lmIter), /*tp_basicsize */ | 368 sizeof(lmIter), /*tp_basicsize */ |
953 {"text", (PyCFunction)lazymanifest_text, METH_NOARGS, | 943 {"text", (PyCFunction)lazymanifest_text, METH_NOARGS, |
954 "Encode this manifest to text."}, | 944 "Encode this manifest to text."}, |
955 {NULL}, | 945 {NULL}, |
956 }; | 946 }; |
957 | 947 |
958 #ifdef IS_PY3K | |
959 #define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT | 948 #define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT |
960 #else | |
961 #define LAZYMANIFEST_TPFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_SEQUENCE_IN | |
962 #endif | |
963 | 949 |
964 static PyTypeObject lazymanifestType = { | 950 static PyTypeObject lazymanifestType = { |
965 PyVarObject_HEAD_INIT(NULL, 0) /* header */ | 951 PyVarObject_HEAD_INIT(NULL, 0) /* header */ |
966 "parsers.lazymanifest", /* tp_name */ | 952 "parsers.lazymanifest", /* tp_name */ |
967 sizeof(lazymanifest), /* tp_basicsize */ | 953 sizeof(lazymanifest), /* tp_basicsize */ |