Skip to content

Commit

Permalink
BUG: Fix build under Python 2.7. Closes #1180. Thanks to Fabian Pedre…
Browse files Browse the repository at this point in the history
…gosa.

This patch defines a macro to access C99 extensions from C++.

This prevented scipy.sparse.sparsetools to compile correctly under
python2.7, because the wrappers are C++ files but ndarraytypes.h
references some C99 macros in inttypes.h.
  • Loading branch information
rgommers committed Jul 30, 2010
1 parent da3b913 commit 1c3f75f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions scipy/sparse/sparsetools/SConscript
Expand Up @@ -3,6 +3,7 @@
from numscons import GetNumpyEnvironment

env = GetNumpyEnvironment(ARGUMENTS)
env.PrependUnique(CPPDEFINES = '__STDC_FORMAT_MACROS')

for fmt in ['csr','csc','coo','bsr','dia', 'csgraph']:
sources = [ fmt + '_wrap.cxx' ]
Expand Down
4 changes: 3 additions & 1 deletion scipy/sparse/sparsetools/setup.py
Expand Up @@ -9,7 +9,9 @@ def configuration(parent_package='',top_path=None):
for fmt in ['csr','csc','coo','bsr','dia','csgraph']:
sources = [ fmt + '_wrap.cxx' ]
depends = [ fmt + '.h' ]
config.add_extension('_' + fmt, sources=sources, depends=depends)
config.add_extension('_' + fmt, sources=sources,
define_macros=[('__STDC_FORMAT_MACROS', 1)],
depends=depends)

return config

Expand Down

0 comments on commit 1c3f75f

Please sign in to comment.