D6196: cext: make revlog.c PY_SSIZE_T_CLEAN

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Apr 4 22:31:42 UTC 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6196

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -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;
 



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list