cext: make revlog.c PY_SSIZE_T_CLEAN
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 04 Apr 2019 15:18:06 -0700
changeset 42067 b01bbb8ff1f2
parent 42066 65ed223619ec
child 42068 896b19d12c08
cext: make revlog.c PY_SSIZE_T_CLEAN Without this, Python 3.8 emits a deprecation warning, as using int for # values is deprecated. Many existing modules use PY_SSIZE_T_CLEAN, so this shouldn't be contentious. I audited the file for all # formatters and verified we are using Py_ssize_t everywhere now. Differential Revision: https://phab.mercurial-scm.org/D6196
mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c	Thu Apr 04 18:20:36 2019 -0700
+++ b/mercurial/cext/revlog.c	Thu Apr 04 15:18:06 2019 -0700
@@ -7,6 +7,7 @@
  the GNU General Public License, incorporated herein by reference.
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <assert.h>
 #include <ctype.h>
@@ -1947,7 +1948,7 @@
 static PyObject *index_partialmatch(indexObject *self, PyObject *args)
 {
 	const char *fullnode;
-	int nodelen;
+	Py_ssize_t nodelen;
 	char *node;
 	int rev, i;