Skip to content

Replace pytree_assert with production pytree_check. Remove pytree_unreachable #7655

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

Merged
merged 6 commits into from
Feb 7, 2025

Conversation

swolchok
Copy link
Contributor

@swolchok swolchok commented Jan 14, 2025

Stack from ghstack (oldest at bottom):

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: D68166301

…eachable

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Jan 14, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7655

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 73ce658 with merge base b362ab7 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 14, 2025
swolchok pushed a commit that referenced this pull request Jan 14, 2025
…eachable

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

ghstack-source-id: 261377457
Pull Request resolved: #7655
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

… pytree_unreachable"

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
@swolchok swolchok requested a review from dbort January 17, 2025 23:09
swolchok added a commit that referenced this pull request Jan 17, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 261987906

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

… pytree_unreachable"

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

swolchok added a commit that referenced this pull request Jan 18, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 262028959

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

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

Much nicer behavior than before!

@@ -145,7 +145,8 @@ class PyTree {
} else if (py::isinstance<py::int_>(key)) {
s.key(i) = py::cast<int32_t>(key);
} else {
pytree_assert(false);
throw std::runtime_err(
"invalid key in pytree dict; must be int or string");
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be helpful to print the key type here, though the old code didn't do it either so not a blocker. Similar for other new throw messages in this PR.

… pytree_unreachable"

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jan 23, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 262806899

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

… pytree_unreachable"

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

swolchok added a commit that referenced this pull request Jan 31, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 263972123

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
… pytree_unreachable"

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

[ghstack-poisoned]
swolchok pushed a commit that referenced this pull request Feb 6, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 265152270

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68166301

@facebook-github-bot facebook-github-bot merged commit 786c2cb into gh/swolchok/133/base Feb 7, 2025
47 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/swolchok/133/head branch February 7, 2025 03:51
kirklandsign pushed a commit that referenced this pull request Feb 7, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 265152270

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)
kirklandsign pushed a commit that referenced this pull request Feb 7, 2025
…eachable

Pull Request resolved: #7655

When handling untrusted input, it's not appropriate to use debug-only checks; we should be checking in prod as these are not programmer errors. pytree_unreachable was similarly being used for input validation.
ghstack-source-id: 265152270

Differential Revision: [D68166301](https://our.internmc.facebook.com/intern/diff/D68166301/)

Co-authored-by: Github Executorch <github_executorch@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported release notes: misc Miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants