-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix font weight validation #15271
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
Fix font weight validation #15271
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should definitely get a simple smoke test
29b6780
to
56c53a1
Compare
56c53a1
to
337c0b9
Compare
337c0b9
to
18cecf7
Compare
I actually changed the implementation to only accept a defined list of strings and trying to convert everything else to int. This allows the validator to fail early on invalid strings like "noweight". - Previously, the code using the weight would have failed on that. The implementation uses a fixed list of strings. That is not too nice, because it duplicates ping @dstansby Tests added. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
…v3.1.x Backport PR #15271 on branch v3.1.x (Fix font weight validation)
…271-on-v3.2.x Backport PR #15271 on branch v3.2.x (Fix font weight validation)
try: | ||
return int(s) | ||
except (ValueError, TypeError): | ||
raise ValueError(f'{s} is not a valid font weight. %s') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, hold one, were both these s
's in here?
PR Summary
Fixes #15240. Solution taken from #15240 (comment).