Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make zip strict #840

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Make zip strict #840

wants to merge 1 commit into from

Conversation

ricardoV94
Copy link
Member

Description

Subtle bug showed up in pymc-devs/pymc#7370 where a RandomVariable had a wrong signature

Copy link
Member

@jessegrabowski jessegrabowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously the original author assumed these could never be different length (and I see why he thought so). Judging by the test, the errors comes from not enough arguments being passed to RV. Is there no way to directly check that? The error generated by the zip would not give much guidance to how to debug the issue relative to something like f"NormalRV expected 2 inputs, got {len(inputs): {", ".join([str(x) for x in inputs])"

@ricardoV94
Copy link
Member Author

Is there no way to directly check that?

There is but I was hoping my lazy fix would fly under the radar. Well it did not :D

@jessegrabowski
Copy link
Member

jessegrabowski commented Jun 24, 2024

Even if you add a more specific input check, zip should probably still be strict as a last line of defense. So the lazy solution is not implemented in vein!

@ricardoV94
Copy link
Member Author

Even if you add a more specific input check, zip should probably still be strict as a last line of defense. So the lazy solution is not implemented in vein!

That gives me little solace but thank you :D. Mondays are the worst

@Armavica
Copy link
Member

Are we interested in a PR making all the zips strict (or explicitly non-strict)? It's a ruff rule that is not enabled for PyTensor: https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/

@ricardoV94
Copy link
Member Author

Are we interested in a PR making all the zips strict (or explicitly non-strict)? It's a ruff rule that is not enabled for PyTensor: https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/

Maybe, do you like it?

@Armavica
Copy link
Member

Maybe, do you like it?

No, I love it

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.

None yet

3 participants