Skip to content

Fix singleton squeeze to preserve array views - #9276

Merged
akaszynski merged 2 commits into
pyvista:mainfrom
guhou-hvi:fix/singleton-squeeze
Sep 19, 2026
Merged

akaszynski merged 2 commits into
pyvista:mainfrom
guhou-hvi:fix/singleton-squeeze

Conversation

@guhou-hvi

Copy link
Copy Markdown
Contributor

Overview

Resolves #3653. pyvista_ndarray.squeeze() and np.squeeze() retain zero-dimensional array views for singleton inputs, including complex dataset arrays, so writes continue to update the owning dataset. Reductions still return scalars.

The ndarray and datasetattributes core modules pass on NumPy 1.26.4 and 2.4.6 (240 passed, 3 skipped each). Changed-file lint and docstyle pass. Full doctests pass 1,701 cases, with the same five failures as main; full-project lint, docstyle and type-check diagnostics also match the baseline.

Codex drafted the code, tests, documentation, and PR description, ran the local checks, and provided an independent agent review; I have reviewed and understand the changes.

Generated with OpenAI Codex.

@github-actions github-actions Bot added the bug Uh-oh! Something isn't working as expected. label Sep 16, 2026
numpydoc's make_xref with numpydoc_xref_param_type=True splits the
parameter type on spaces/or/commas. The bare word 'of' in
'int or tuple of int, optional' becomes an unresolvable :obj: reference
under nitpicky=True, failing the CI docs build.

Rewrite as PEP 585 subscript 'tuple[int, ...]' which is the established
PyVista convention (e.g. pointset.py, composite.py) and avoids the
unresolvable 'of' reference. All other tokens in the type field are
resolved via intersphinx (python:int, python:tuple) or explicitly
ignored via nitpick_ignore_regex ('optional').

Docstring-only change; no logic, signature, or behavior change.
@akaszynski
akaszynski added this pull request to the merge queue Sep 19, 2026
Merged via the queue into pyvista:main with commit 58389a7 Sep 19, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Uh-oh! Something isn't working as expected.

Development

Successfully merging this pull request may close these issues.

pyvista_ndarray broken for size 1

2 participants