bpo-20180: Simplify char_converter in Argument Clinic. by serhiy-storchaka · Pull Request #9828 · python/cpython (original) (raw)
@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.