You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@serhiy-storchaka, I wrote the existing escaping mechanism based on my reading of the C standard, since self.c_default needs to be a valid C character literal. It seemed to be a safer way to ensure creating a valid C char literal than relying on e.g. repr(bytes(...)), which we might decide to change in the future.
I recall also being surprised by '?' having an escape sequence, but I don't remember why I decided to keep it at the end; perhaps just for completeness, having included all of the other escape sequences.
I definitely defer to your judgement on this. I'm not a C expert and so I was extra-careful when I wrote this code, perhaps overly so.
I think that the repr of str and bytes was intentionally made mostly compatible with C (except that they can use either singular or double quotes). It is very unlikely that they will be made incompatible in future.
? can be need to be escaped because of trigraph sequences like ??=. But in our case ? is a single character.
The reason will be displayed to describe this comment to others. Learn more.
It seems like you fixed a bug, so I would expect a new test to check for non-regression. Is it something doable? Sorry, I didn't look at test_clinic.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
char_converterconverter can be simpler.The current code doesn't work correctly with characters from 0x0e to 0x1f and >= 0x7f. And it escapes
?for unknown reasons.https://bugs.python.org/issue20180