# HG changeset patch # User Gregory Szorc # Date 2016-10-09 11:47:46 # Node ID a989fa78dafa228d09c12c48e9e2d85ed7a9beb7 # Parent 79f438f5dd02e210395aad0a4efde317e616781b osutil: use PyLongObject on Python 3 for listdir_slot This code looks performance sensitive. So let's retain PyIntObject on Python 2 and use PyLongObject explicitly on Python 3. diff --git a/mercurial/osutil.c b/mercurial/osutil.c --- a/mercurial/osutil.c +++ b/mercurial/osutil.c @@ -63,11 +63,19 @@ struct listdir_stat { }; #endif +#ifdef IS_PY3K +#define listdir_slot(name) \ + static PyObject *listdir_stat_##name(PyObject *self, void *x) \ + { \ + return PyLong_FromLong(((struct listdir_stat *)self)->st.name); \ + } +#else #define listdir_slot(name) \ static PyObject *listdir_stat_##name(PyObject *self, void *x) \ { \ return PyInt_FromLong(((struct listdir_stat *)self)->st.name); \ } +#endif listdir_slot(st_dev) listdir_slot(st_mode)