summaryrefslogtreecommitdiff
path: root/weave/ext_tools.py
diff options
context:
space:
mode:
authorFernando Perez <fperez@fperez.org>2005-06-17 15:21:13 +0000
committerFernando Perez <fperez@fperez.org>2005-06-17 15:21:13 +0000
commit2ff0186a9874cbaf93eb4e209698c6cb978c6160 (patch)
treeae5812614f9fb057ab31232a2f99bb4c0c1d7dc3 /weave/ext_tools.py
parentc1410bcd80415fcf6b2c4ceffc58257d6b4ff9af (diff)
downloadnumpy-2ff0186a9874cbaf93eb4e209698c6cb978c6160.tar.gz
Make sure Python.h are the very first headers in auto-generated code, even before blitz/array.h. This is required by the Python C-API, as otherwise nasty warnings are generated.
Diffstat (limited to 'weave/ext_tools.py')
-rw-r--r--weave/ext_tools.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/weave/ext_tools.py b/weave/ext_tools.py
index 17f68c012..0475d7a91 100644
--- a/weave/ext_tools.py
+++ b/weave/ext_tools.py
@@ -214,14 +214,27 @@ class ext_module:
for i in info:
i.set_compiler(self.compiler)
return info
-
+
def get_headers(self):
all_headers = self.build_information().headers()
- # blitz/array.h always needs to be first so we hack that here...
+ # blitz/array.h always needs to go before most other headers, so we
+ # hack that here, but we need to ensure that Python.h is the very
+ # first header included. As indicated in
+
+ # http://docs.python.org/api/includes.html
+
+ # "Warning: Since Python may define some pre-processor definitions which
+ # affect the standard headers on some systems, you must include Python.h
+ # before any standard headers are included. "
+
+ # Since blitz/array.h pulls in system headers, we must massage this
+ # list a bit so that the order is Python.h, blitz/array.h, ...
+
if '"blitz/array.h"' in all_headers:
all_headers.remove('"blitz/array.h"')
- all_headers.insert(0,'"blitz/array.h"')
+ # Insert blitz AFTER Python.h, which must remain the first header
+ all_headers.insert(1,'"blitz/array.h"')
return all_headers
def warning_code(self):