diff options
author | Guido van Rossum <guido@python.org> | 1998-02-19 21:18:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-02-19 21:18:56 (GMT) |
commit | b1908846af1c70e77917d56798daa8242d80d2b5 (patch) | |
tree | 81e8898c2a7cb3311f310f4a83f52dab38370ec2 /Lib/re.py | |
parent | 72c2e1b56e35c7fc4a80e90b14541494426e3cd0 (diff) | |
download | cpython-b1908846af1c70e77917d56798daa8242d80d2b5.zip cpython-b1908846af1c70e77917d56798daa8242d80d2b5.tar.gz cpython-b1908846af1c70e77917d56798daa8242d80d2b5.tar.bz2 |
Fix for literal null bytes -- these must be replaced by the four
characters \, 0, 0, 0.
Diffstat (limited to 'Lib/re.py')
-rw-r--r-- | Lib/re.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -66,8 +66,9 @@ def escape(pattern): alphanum=string.letters+'_'+string.digits for char in pattern: if char not in alphanum: - result.append('\\') - result.append(char) + if char == '\000': result.append(r'\000') + else: result.append('\\' + char) + else: result.append(char) return string.join(result, '') def compile(pattern, flags=0): |