Skip to content

fix: allow array-like fill_between where masks#31898

Open
cyphercodes wants to merge 1 commit into
matplotlib:mainfrom
cyphercodes:fix-fill-between-where-typing
Open

fix: allow array-like fill_between where masks#31898
cyphercodes wants to merge 1 commit into
matplotlib:mainfrom
cyphercodes:fix-fill-between-where-typing

Conversation

@cyphercodes

Copy link
Copy Markdown

PR summary

Axes.fill_between and Axes.fill_betweenx already accept NumPy boolean masks for where at runtime, but their stubs only allowed Sequence[bool]. This widens the where annotation to ArrayLike, matching the rest of the input arrays and avoiding false-positive type checker errors for np.ndarray masks.

Fixes #31890.

AI assistance was used to prepare this patch.

PR checklist

  • The changes are tested and documented.
  • The issue is referenced.

Testing

  • PYTHONPATH=lib pyright /tmp/mpl_fill_between_pyright.py
  • python -m compileall -q lib/matplotlib/axes/_axes.pyi
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Type hints for where argument in ax.fill_between does not allow np.ndarrays

1 participant