Patchwork manifest: include Python.h before standard headers

login
register
mail settings
Submitter Drew Gottlieb
Date March 18, 2015, 6:42 p.m.
Message ID <134a586a0b3839d85ff3.1426704126@waste.org>
Download mbox | patch
Permalink /patch/8147/
State Accepted
Commit d6dbe4d1c9bc8834e4afe42b18e70160745900f0
Headers show

Comments

Drew Gottlieb - March 18, 2015, 6:42 p.m.
# HG changeset patch
# User Drew Gottlieb <drgott@google.com>
# Date 1426704096 25200
#      Wed Mar 18 11:41:36 2015 -0700
# Node ID 134a586a0b3839d85ff3e6a3a35c64b09dc493d0
# Parent  b7f936f47f2b104a60840bae571e009742126afc
manifest: include Python.h before standard headers

Python.h should be included before any standard headers according to the
python docs: https://docs.python.org/2/c-api/intro.html#include-files
Matt Mackall - March 18, 2015, 8:59 p.m.
On Wed, 2015-03-18 at 13:42 -0500, Drew Gottlieb wrote:
> # HG changeset patch
> # User Drew Gottlieb <drgott@google.com>
> # Date 1426704096 25200
> #      Wed Mar 18 11:41:36 2015 -0700
> # Node ID 134a586a0b3839d85ff3e6a3a35c64b09dc493d0
> # Parent  b7f936f47f2b104a60840bae571e009742126afc
> manifest: include Python.h before standard headers

Queued for default, thanks. Did this have any visible impact?
Drew Gottlieb - March 18, 2015, 9 p.m.
Not that I saw. I think the guideline is mostly just cautionary.

On Wed, Mar 18, 2015 at 1:59 PM Matt Mackall <mpm@selenic.com> wrote:

> On Wed, 2015-03-18 at 13:42 -0500, Drew Gottlieb wrote:
> > # HG changeset patch
> > # User Drew Gottlieb <drgott@google.com>
> > # Date 1426704096 25200
> > #      Wed Mar 18 11:41:36 2015 -0700
> > # Node ID 134a586a0b3839d85ff3e6a3a35c64b09dc493d0
> > # Parent  b7f936f47f2b104a60840bae571e009742126afc
> > manifest: include Python.h before standard headers
>
> Queued for default, thanks. Did this have any visible impact?
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>

Patch

diff --git a/mercurial/manifest.c b/mercurial/manifest.c
--- a/mercurial/manifest.c
+++ b/mercurial/manifest.c
@@ -6,12 +6,12 @@ 
  * This software may be used and distributed according to the terms of
  * the GNU General Public License, incorporated herein by reference.
  */
+#include <Python.h>
+
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
-#include <Python.h>
-
 /* VC9 doesn't include bool and lacks stdbool.h based on my searching */
 #ifdef _MSC_VER
 #define true 1