Patchwork D12222: cext: drop preprocessor PyInt aliases

login
register
mail settings
Submitter phabricator
Date March 2, 2022, 12:22 a.m.
Message ID <differential-rev-PHID-DREV-7p7gznasdgdrrxzuadqw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50560/
State New
Headers show

Comments

phabricator - March 2, 2022, 12:22 a.m.
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that we dropped support for Python 2 we can use the Python 3 native
  functions.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/charencode.c

CHANGE DETAILS




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

Patch

diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c
--- a/mercurial/cext/charencode.c
+++ b/mercurial/cext/charencode.c
@@ -15,14 +15,6 @@ 
 #include "compat.h"
 #include "util.h"
 
-#ifdef IS_PY3K
-/* The mapping of Python types is meant to be temporary to get Python
- * 3 to compile. We should remove this once Python 3 support is fully
- * supported and proper types are used in the extensions themselves. */
-#define PyInt_Type PyLong_Type
-#define PyInt_AS_LONG PyLong_AS_LONG
-#endif
-
 /* clang-format off */
 static const char lowertable[128] = {
 	'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
@@ -228,12 +220,12 @@ 
 	const char *table;
 
 	if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", &PyDict_Type,
-	                      &dmap, &PyInt_Type, &spec_obj, &PyFunction_Type,
+	                      &dmap, &PyLong_Type, &spec_obj, &PyFunction_Type,
 	                      &normcase_fallback)) {
 		goto quit;
 	}
 
-	spec = (int)PyInt_AS_LONG(spec_obj);
+	spec = (int)PyLong_AS_LONG(spec_obj);
 	switch (spec) {
 	case NORMCASE_LOWER:
 		table = lowertable;