Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: initialize ragged Poly3DCollection padding with NaN - #32279

Closed
dajiaohuang wants to merge 1 commit into
matplotlib:mainfrom
dajiaohuang:fix/32272-poly3d-projection
Closed

fix: initialize ragged Poly3DCollection padding with NaN#32279
dajiaohuang wants to merge 1 commit into
matplotlib:mainfrom
dajiaohuang:fix/32272-poly3d-projection

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

When Poly3DCollection receives polygons with different numbers of vertices, it creates a padded rectangular array using np.empty(). Unused entries are marked as invalid via _invalid_vertices, but do_3d_projection() projects the complete backing array before applying that mask. Uninitialized padding values can contain values near float64 max, causing RuntimeWarning: overflow encountered in dot.

Fix

Replace np.empty() with np.full(..., np.nan) when creating padded storage for ragged polygons. NaN values propagate safely through matrix operations and are later masked out by _invalid_vertices.

Fixes #32272

Replace np.empty() with np.full(..., np.nan) when creating padded
storage for ragged polygons. Previously uninitialized padding could
contain arbitrary values that caused overflow in projection.

Fixes matplotlib#32272
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@rcomer

rcomer commented Sep 2, 2026

Copy link
Copy Markdown
Member

This account is opening a lot of PRs in a short space of time so I assume they are automated.
https://github.com/pulls/2557446?q=is%3Apr+sort%3Acreated-desc+author%3Adajiaohuang

Closing the PR and blocking the account for a week per our policy
https://matplotlib.org/devdocs/devel/contribute.html#use-of-generative-ai

@rcomer rcomer closed this Sep 2, 2026
@matplotlib matplotlib temporarily blocked dajiaohuang Sep 2, 2026
@rcomer rcomer added the ai-contribution PRs that are AI generated without a human in the loop label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-contribution PRs that are AI generated without a human in the loop first-contribution topic: mplot3d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ragged Poly3DCollection projects uninitialized padding, causing nondeterministic overflow

2 participants