8000 BUG: Fix misuse of .names and .fields in various places by eric-wieser · Pull Request #14290 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix misuse of .names and .fields in various places #14290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 22, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MAINT: Fix remaining misuses of bool(dt.names)
It's not clear that these have any visible effect, but we should be consistent with how we detect structured types.
  • Loading branch information
eric-wieser committed Aug 20, 2019
commit 483f565d85dadc899f94710531fba8355d554d59
6 changes: 3 additions & 3 deletions numpy/lib/recfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def recursive_fill_fields(input, output):
current = input[field]
except ValueError:
continue
if current.dtype.names:
if current.dtype.names is not None:
recursive_fill_fields(current, output[field])
else:
output[field][:len(current)] = current
Expand Down Expand Up @@ -437,7 +437,7 @@ def merge_arrays(seqarrays, fill_value=-1, flatten=False,
if isinstance(seqarrays, (ndarray, np.void)):
seqdtype = seqarrays.dtype
# Make sure we have named fields
if not seqdtype.names:
if seqdtype.names is None:
seqdtype = np.dtype([('', seqdtype)])
if not flatten or zip_dtype((seqarrays,), flatten=True) == seqdtype:
# Minimal processing needed: just make sure everythng's a-ok
Expand Down Expand Up @@ -657,7 +657,7 @@ def _recursive_rename_fields(ndtype, namemapper):
for name in ndtype.names:
newname = namemapper.get(name, name)
current = ndtype[name]
if current.names:
if current.names is not None:
newdtype.append(
(newname, _recursive_rename_fields(current, namemapper))
)
Expand Down
0