diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-12-20 13:27:40 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-20 13:27:40 -0600 |
| commit | 229c1757609efbbeea96b90746bcbe5ba41e0397 (patch) | |
| tree | 24af9054f4e543709195f9e298e51cd9c03dac03 /numpy/testing | |
| parent | 1531820cec59939a34745c869d1365a85fc6869c (diff) | |
| download | numpy-229c1757609efbbeea96b90746bcbe5ba41e0397.tar.gz | |
MAINT: Use intp output param viewable casts/methods (#20176)
This removes the cast-is-view flag with a more generic intp output.
Such an output could (theoretically) be nonzero, indicating e.g.
the offset of a complex number into a real one.
(We do not use this yet, though!)
The only "tricky" part is that the MinCastSafety helper used to
deal with the view-offset as well, and now we have to deal with it
explicitly when e.g. multiple fields have to be checked.
Bumps the experimental-dtype-api number, since the signatures changed.
* MAINT,DOC: Cleanups and clarfications based on Marten's comments
Co-Authored-By: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
* MAINT: Rename `PyArray_GetCastSafety` to `PyArray_GetCastInfo`
Better captures the fact that it also returns the view-offset
information now.
* MAINT: Fix structured cast-is-view logic
* MAINT: Address review comments by Marten
Co-authored-by: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
Diffstat (limited to 'numpy/testing')
| -rwxr-xr-x | numpy/testing/print_coercion_tables.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/numpy/testing/print_coercion_tables.py b/numpy/testing/print_coercion_tables.py index 3a447cd2d..c1d4cdff8 100755 --- a/numpy/testing/print_coercion_tables.py +++ b/numpy/testing/print_coercion_tables.py @@ -87,11 +87,12 @@ def print_new_cast_table(*, can_cast=True, legacy=False, flags=False): from numpy.core._multiarray_tests import get_all_cast_information cast_table = { - 0 : "#", # No cast (classify as equivalent here) - 1 : "#", # equivalent casting - 2 : "=", # safe casting - 3 : "~", # same-kind casting - 4 : ".", # unsafe casting + -1: " ", + 0: "#", # No cast (classify as equivalent here) + 1: "#", # equivalent casting + 2: "=", # safe casting + 3: "~", # same-kind casting + 4: ".", # unsafe casting } flags_table = { 0 : "▗", 7: "█", |
