diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-21 07:57:12 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-21 07:57:12 +0000 |
commit | 3faacbbc2b90a123440423ad6db109d7a6b978f0 (patch) | |
tree | 385b4e971bd42b1da50edf5a9837c980b0464e80 /numpy/core/setup.py | |
parent | edb79679e92ccda68d87a69bb3e291cb2c36f5a5 (diff) | |
download | numpy-3faacbbc2b90a123440423ad6db109d7a6b978f0.tar.gz |
Fix memory leak and Fix segfault on Python2.3 by disabling threading.
Diffstat (limited to 'numpy/core/setup.py')
-rw-r--r-- | numpy/core/setup.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 03a389700..3a7df8f63 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -35,12 +35,27 @@ def configuration(parent_package='',top_path=None): library_dirs = default_lib_dirs) if not result: raise "ERROR: Failed to test configuration" - # Perhaps a fancier check is in order here. - try: - nosmp = os.environ['NPY_NOSMP'] + + # Python 2.3 causes a segfault when + # trying to re-acquire the thread-state + # which is done in error-handling + # ufunc code. NPY_ALLOW_C_API and friends + # cause the segfault. So, we disable threading + # for now. + if sys.version[:3] < '2.4': nosmp = 1 - except KeyError: - nosmp = 0 + else: + # Perhaps a fancier check is in order here. + # so that threads are only enabled if there + # are actually multiple CPUS? -- but + # threaded code can be nice even on a single + # CPU so that long-calculating code doesn't + # block. + try: + nosmp = os.environ['NPY_NOSMP'] + nosmp = 1 + except KeyError: + nosmp = 0 if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] else: moredefs = [] # |