From b5895be146cdc3063ffa9ca8ae27b5bcf7992719 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 14 Apr 2019 19:26:53 -0700 Subject: BUG: Fix structured_to_unstructured on single-field types Previously a single-field type would decay, which is undesirable. The included test previously did not pass --- numpy/lib/recfunctions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/recfunctions.py') diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index fcc0d9a7a..bf588a490 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -976,7 +976,7 @@ def structured_to_unstructured(arr, dtype=None, copy=False, casting='unsafe'): arr = arr.astype(packed_fields, copy=copy, casting=casting) # finally is it safe to view the packed fields as the unstructured type - return arr.view((out_dtype, sum(counts))) + return arr.view((out_dtype, (sum(counts),))) def _unstructured_to_structured_dispatcher(arr, dtype=None, names=None, align=None, copy=None, casting=None): -- cgit v1.2.1