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

Change sprintf "%c" to support only Char and Int::Primitive types #15142

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

Conversation

nanobowers
Copy link

Change sprintf "%c" to support only Char and Int::Primitive types. (The restriction on Int::Primitive is because BigInt apparently doesn't support chr conversion).

Non Char/Int::Primitive arguments will raise an ArgumentError
Support for single-char strings was not included because it sounded like a nice-to-have and not a requirement.

Fixes #11022

src/string/formatter.cr Outdated Show resolved Hide resolved
spec/std/sprintf_spec.cr Outdated Show resolved Hide resolved
src/string/formatter.cr Outdated Show resolved Hide resolved
@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:text labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sprintf "%c" does not check its argument
3 participants