Patchwork [2,of,4] cext: stop preprocessing a partial function call

login
register
mail settings
Submitter Matt Harbison
Date Sept. 13, 2018, 9:44 p.m.
Message ID <058593637119420b3658.1536875054@mharbison-pc.attotech.com>
Download mbox | patch
Permalink /patch/34629/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 13, 2018, 9:44 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1536857030 14400
#      Thu Sep 13 12:43:50 2018 -0400
# Node ID 058593637119420b3658ca40088de036450bd8aa
# Parent  ecbaa8d6b0c2d20b99e80e1552f81520edac09bc
cext: stop preprocessing a partial function call

MSVC++ 14 yelled:

    mercurial/cext/revlog.c(1913): fatal error C1057: unexpected end of file in
                                   macro expansion

At this point, the C extensions build (with warnings), and it dies in win32.py
because the `_fields_` strings in the ctypes classes are being converted to
bytes by the source translator.

Patch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1911,10 +1911,11 @@  static int index_slice_del(indexObject *
 /* Argument changed from PySliceObject* to PyObject* in Python 3. */
 #ifdef IS_PY3K
 	if (PySlice_GetIndicesEx(item, length,
+				 &start, &stop, &step, &slicelength) < 0)
 #else
 	if (PySlice_GetIndicesEx((PySliceObject*)item, length,
+				 &start, &stop, &step, &slicelength) < 0)
 #endif
-				 &start, &stop, &step, &slicelength) < 0)
 		return -1;
 
 	if (slicelength <= 0)