Author: Tomasz Dziopa <[email protected]>
Branch: py3.6
Changeset: r94410:bc678f7e35f0
Date: 2018-04-22 11:23 +0100
http://bitbucket.org/pypy/pypy/changeset/bc678f7e35f0/
Log: (tdziopa) fix default value for first_escape_error_char
As RPython doesn't allow having int and None in the same variable,
the initial value of first_escape_error_char should be fixed to -1.
diff --git a/pypy/interpreter/pyparser/parsestring.py
b/pypy/interpreter/pyparser/parsestring.py
--- a/pypy/interpreter/pyparser/parsestring.py
+++ b/pypy/interpreter/pyparser/parsestring.py
@@ -117,7 +117,7 @@
v, first_escape_error_char = PyString_DecodeEscape(
space, substr, 'strict', encoding)
- if first_escape_error_char is not None:
+ if first_escape_error_char != -1:
space.warn("invalid excape sequence '\\%c'" % first_escape_error_char,
space.w_DeprecationWarning)
@@ -164,7 +164,7 @@
builder = StringBuilder(len(s))
ps = 0
end = len(s)
- first_escape_error_char = None
+ first_escape_error_char = -1
while ps < end:
if s[ps] != '\\':
# note that the C code has a label here.
@@ -244,7 +244,7 @@
builder.append('\\')
ps -= 1
assert ps >= 0
- if first_escape_error_char is None:
+ if first_escape_error_char == -1:
first_escape_error_char = ch
continue
# an arbitry number of unescaped UTF-8 bytes may follow.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit