Mercurial > hg
diff mercurial/cext/parsers.c @ 47512:769037a279ec
dirstate-entry: add a `state` property (and use it)
This replace the [0] access. Ultimately is we should probably get ride of this
in its current form. However this is a good transitional solution to move away
for tuple indexing for now.
Differential Revision: https://phab.mercurial-scm.org/D10954
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 04 Jul 2021 03:29:20 +0200 |
parents | 80dc1d452993 |
children | 10e740292dff |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Sat Jul 03 19:52:00 2021 +0200 +++ b/mercurial/cext/parsers.c Sun Jul 04 03:29:20 2021 +0200 @@ -150,6 +150,16 @@ {NULL} /* Sentinel */ }; +static PyObject *dirstatetuple_get_state(dirstateTupleObject *self) +{ + return PyBytes_FromStringAndSize(&self->state, 1); +}; + +static PyGetSetDef dirstatetuple_getset[] = { + {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL}, + {NULL} /* Sentinel */ +}; + PyTypeObject dirstateTupleType = { PyVarObject_HEAD_INIT(NULL, 0) /* header */ "dirstate_tuple", /* tp_name */ @@ -180,7 +190,7 @@ 0, /* tp_iternext */ dirstatetuple_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + dirstatetuple_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */