Skip to content

Fix #19491, crash when using enable_error_code value of wrong type in pyproject.toml #19494

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

wyattscarpenter
Copy link
Contributor

@wyattscarpenter wyattscarpenter commented Jul 24, 2025

Fixes #19491

If you give a string in toml, you get Invalid error code(s): whatever. However, if you give a value that doesn't mean a string in toml, you get a crash like TypeError: 'int' object is not iterable.

I suspect this would also apply to many other pyproject.toml values if you set them wrong, because we pass many of them immediately into try_split, which tries to iterate them.

I have added a (fairly minimal) test for this behavior.

This comment has been minimized.

@wyattscarpenter wyattscarpenter marked this pull request as draft July 26, 2025 01:12
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@wyattscarpenter
Copy link
Contributor Author

The fact that we're now raising an error instead of allowing the value to go through and yet the test apparently still passes makes me wonder if the test is wrong. Or maybe I just got lucky and the implications of raising an error result in the same error message and thus pass the test the same way.

@wyattscarpenter wyattscarpenter marked this pull request as ready for review July 29, 2025 08:00
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.

Crash when using an invalid 'enable_error_code' value in pyproject.toml
2 participants