[Numpy-discussion] bugfix-patch for numpy-1.0b2 setup

Norbert Nemec Norbert.Nemec.list at gmx.de
Sun Aug 20 05:51:52 CDT 2006

Travis Oliphant wrote:
> Norbert Nemec wrote:
>> Hi there,
>> in numpy-1.0b2 the logic in setup.py is slightly off. The attached patch
>> fixes the issue.
>> Greetings,
>> Norbert
>> PS: I would have preferred to submit this patch via the sourceforge
>> bug-tracker, but that seems rather confusing: there are tabs "Numarray
>> Patches" and "Numarray Bugs" but no "NumPy bugs" and the tab "Patches"
>> seems to be used for Numeric. Why isn't NumPy handled via the
>> Sourceforge page?
> NumPy development happens on the SVN servers at scipy.org and 
> bug-tracking is handled through the Trac system at
> http://projects.scipy.org/scipy/numpy
> We only use sourceforge for distribution.
OK, sorry. I found this myself in the meantime. I even remember that I
stumbled over this some time ago already. Problem is: I'm submitting
bug-reports, fixes and small patches to so many different projects, that
I start mixing up the details of the individual procedures.

Furthermore: the TRAC tickets do not seem to allow attachment of
patches. Did I miss something there?

> I need more description on why the logic is not right.
The original code reads:


            if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')]
            else: moredefs = []
            if moredefs:
                target_f = open(target,'a')
                for d in moredefs:
                    if isinstance(d,str):
                        target_f.write('#define %s\n' % (d))
                        target_f.write('#define %s %s\n' % (d[0],d[1]))
                if not nosmp:  # default is to use WITH_THREAD
                    target_f.write('#ifdef WITH_THREAD\n#define
NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n')

That is: if not nosmp, then moredefs may be empty, in which case
NPY_ALLOW_THREADS is not defined at all. My patch ensures that
NPY_ALLOW_THREADS is defined in any case, either by putting it in
moredefs, or by adding the special conditional define.

The conditional "if moredefs" is not needed at all: the file needs to be
opened in any case, to define NPY_ALLOW_THREADS one way or other.


More information about the Numpy-discussion mailing list