Patchwork cext: move PyInt macros to charencode.c properly

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2017, 7:53 a.m.
Message ID <9d9186f859585f2513e3.1502697180@mimosa>
Download mbox | patch
Permalink /patch/22966/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 14, 2017, 7:53 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1502685326 -32400
#      Mon Aug 14 13:35:26 2017 +0900
# Node ID 9d9186f859585f2513e3bde3a304cc72cb534565
# Parent  f7d6978a4da9deed920535630c32509683f29915
cext: move PyInt macros to charencode.c properly

Python3 build was broken at e9996bd7203f.
Augie Fackler - Aug. 15, 2017, 7:54 p.m.
On Mon, Aug 14, 2017 at 04:53:00PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1502685326 -32400
> #      Mon Aug 14 13:35:26 2017 +0900
> # Node ID 9d9186f859585f2513e3bde3a304cc72cb534565
> # Parent  f7d6978a4da9deed920535630c32509683f29915
> cext: move PyInt macros to charencode.c properly

queued, thanks

Patch

diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c
--- a/mercurial/cext/charencode.c
+++ b/mercurial/cext/charencode.c
@@ -13,6 +13,14 @@ 
 #include "charencode.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
+
 static const char lowertable[128] = {
 	'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
 	'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -20,11 +20,9 @@ 
 /* 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_Check PyLong_Check
 #define PyInt_FromLong PyLong_FromLong
 #define PyInt_FromSsize_t PyLong_FromSsize_t
-#define PyInt_AS_LONG PyLong_AS_LONG
 #define PyInt_AsLong PyLong_AsLong
 #endif