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

Fix escaped % printing in new Printf code #37785

Merged
merged 2 commits into from
Oct 6, 2020
Merged

Fix escaped % printing in new Printf code #37785

merged 2 commits into from
Oct 6, 2020

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Sep 28, 2020

Fixes #37784. The classic blunder of not unescaping the escaped when
printing. I considered trying to detect escaped chars during format
construction-time, but there isn't a clean way to utilize the current
Printf.Format structure to achieve this, since it requires
length(f.formats) == length(f.substringranges) + 1, and
f.substringranges must be the concretely typed
Vector{UnitRange{Int}}. Doing the unescaping in Printf.format when
we're outputting seems to not incur any performance penalty and seems
like a pretty clean fix since all outputting is handled in this one
function anyway.

Fixes #37784. The classic blunder of not unescaping the escaped when
printing. I considered trying to detect escaped chars during format
construction-time, but there isn't a clean way to utilize the current
`Printf.Format` structure to achieve this, since it requires
`length(f.formats) == length(f.substringranges) + 1`, and
`f.substringranges` must be the concretely typed
`Vector{UnitRange{Int}}`. Doing the unescaping in `Printf.format` when
we're outputting seems to not incur any performance penalty and seems
like a pretty clean fix since all outputting is handled in this one
function anyway.
@quinnj quinnj merged commit aa5e76a into master Oct 6, 2020
@quinnj quinnj deleted the jq/37784 branch October 6, 2020 14:21
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.

Incorrect escaping in Printf on master (@sprintf("GAP[%%]"))
1 participant