[pypy-commit] pypy default: the previous "unicode == '\x00'" gives a non-well-defined result
arigo
noreply at buildbot.pypy.org
Mon Sep 21 09:12:31 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r79732:fce28c21dc9b
Date: 2015-09-21 09:12 +0200
http://bitbucket.org/pypy/pypy/changeset/fce28c21dc9b/
Log: the previous "unicode == '\x00'" gives a non-well-defined result
depending on the host python's default encoding
diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -574,7 +574,9 @@
return self.basecharclass()
def method_split(self, patt, max=-1):
- if max == -1 and patt.is_constant() and patt.const == "\0":
+ # special-case for .split( '\x00') or .split(u'\x00')
+ if max == -1 and patt.is_constant() and (
+ len(patt.const) == 1 and ord(patt.const) == 0):
no_nul = True
else:
no_nul = self.no_nul
More information about the pypy-commit
mailing list