summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-12-27 17:46:19 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-12-27 17:46:19 +0000
commit8a05dfde430393244bc86f23186c3bd487a729da (patch)
tree246a2d9f31206d4b0e00bc5e66c922d6f409f5b4 /numpy
parent5b6b1fe2f957e22162233878888e2e3d5454a6a9 (diff)
downloadnumpy-8a05dfde430393244bc86f23186c3bd487a729da.tar.gz
MAINT: Reorder if branches to avoid condition duplication
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/code_generators/generate_umath.py49
1 files changed, 24 insertions, 25 deletions
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
index 40bc1560f..ec62df590 100644
--- a/numpy/core/code_generators/generate_umath.py
+++ b/numpy/core/code_generators/generate_umath.py
@@ -949,30 +949,7 @@ def make_arrays(funcdict):
thedict = chartotype1 # one input and one output
for t in uf.type_descriptions:
- if (t.func_data not in (None, FullTypeDescr) and
- not isinstance(t.func_data, FuncNameSuffix)):
- funclist.append('NULL')
- astype = ''
- if not t.astype is None:
- astype = '_As_%s' % thedict[t.astype]
- astr = ('%s_functions[%d] = PyUFunc_%s%s;' %
- (name, k, thedict[t.type], astype))
- code2list.append(astr)
- if t.type == 'O':
- astr = ('%s_data[%d] = (void *) %s;' %
- (name, k, t.func_data))
- code2list.append(astr)
- datalist.append('(void *)NULL')
- elif t.type == 'P':
- datalist.append('(void *)"%s"' % t.func_data)
- else:
- astr = ('%s_data[%d] = (void *) %s;' %
- (name, k, t.func_data))
- code2list.append(astr)
- datalist.append('(void *)NULL')
- #datalist.append('(void *)%s' % t.func_data)
- sub += 1
- elif t.func_data is FullTypeDescr:
+ if t.func_data is FullTypeDescr:
tname = english_upper(chartoname[t.type])
datalist.append('(void *)NULL')
funclist.append(
@@ -982,7 +959,7 @@ def make_arrays(funcdict):
tname = english_upper(chartoname[t.type])
funclist.append(
'%s_%s_%s' % (tname, name, t.func_data.suffix))
- else:
+ elif t.func_data is None:
datalist.append('(void *)NULL')
tname = english_upper(chartoname[t.type])
funclist.append('%s_%s' % (tname, name))
@@ -998,6 +975,28 @@ def make_arrays(funcdict):
ISA=vt.upper(), isa=vt,
fname=name, type=tname, idx=k
))
+ else:
+ funclist.append('NULL')
+ astype = ''
+ if not t.astype is None:
+ astype = '_As_%s' % thedict[t.astype]
+ astr = ('%s_functions[%d] = PyUFunc_%s%s;' %
+ (name, k, thedict[t.type], astype))
+ code2list.append(astr)
+ if t.type == 'O':
+ astr = ('%s_data[%d] = (void *) %s;' %
+ (name, k, t.func_data))
+ code2list.append(astr)
+ datalist.append('(void *)NULL')
+ elif t.type == 'P':
+ datalist.append('(void *)"%s"' % t.func_data)
+ else:
+ astr = ('%s_data[%d] = (void *) %s;' %
+ (name, k, t.func_data))
+ code2list.append(astr)
+ datalist.append('(void *)NULL')
+ #datalist.append('(void *)%s' % t.func_data)
+ sub += 1
for x in t.in_ + t.out:
siglist.append('NPY_%s' % (english_upper(chartoname[x]),))