-
Notifications
You must be signed in to change notification settings - Fork 172
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
utils.str: Handle \0 in perlReToReplacer #1536
base: master
Are you sure you want to change the base?
Conversation
It is required to use \g<0> as otherwise Python will process \0 as a 0 byte.
I did some testing and it seems that I think in these cases it's better to preserve the Python behaviour to avoid introducing inconsistencies, and use
Interestingly it seems perl also treats
|
@@ -298,7 +298,8 @@ def perlReToReplacer(s): | |||
regexp = regexp.replace('\x08', r'\b') | |||
replace = replace.replace('\\'+sep, sep) | |||
for i in range(10): | |||
replace = replace.replace(chr(i), r'\%s' % i) | |||
replace = replace.replace(chr(i), r'\g<%s>' % i) | |||
replace = replace.replace(r'\0', r'\g<0>') |
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 line looks redundant
this one doesn't really make sense on IRC |
Given the nested commands support though, not all command output is necessarily made to be displayed. |
It is required to use \g<0> as otherwise Python will process \0 as a 0 byte.
Previous behaviour: