[pypy-commit] pypy default: Why final=False here?
arigo
pypy.commits at gmail.com
Sun Sep 4 08:50:21 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r86861:50051cb90662
Date: 2016-09-04 14:39 +0200
http://bitbucket.org/pypy/pypy/changeset/50051cb90662/
Log: Why final=False here?
diff --git a/rpython/rtyper/rstr.py b/rpython/rtyper/rstr.py
--- a/rpython/rtyper/rstr.py
+++ b/rpython/rtyper/rstr.py
@@ -30,7 +30,7 @@
assert value is not None
result = UnicodeBuilder(len(value))
self.rstr_decode_utf_8(
- value, len(value), 'strict', final=False,
+ value, len(value), 'strict', final=True,
errorhandler=self.ll_raise_unicode_exception_decode,
allow_surrogates=False, result=result)
return self.ll.llunicode(result.build())
diff --git a/rpython/rtyper/test/test_runicode.py b/rpython/rtyper/test/test_runicode.py
--- a/rpython/rtyper/test/test_runicode.py
+++ b/rpython/rtyper/test/test_runicode.py
@@ -162,6 +162,18 @@
assert self.ll_to_string(self.interpret(f, [0])) == f(0)
+ def test_unicode_decode_final(self):
+ strings = ['\xc3', '']
+ def f(n):
+ try:
+ strings[n].decode('utf-8')
+ except UnicodeDecodeError:
+ return True
+ return False
+
+ assert f(0)
+ assert self.interpret(f, [0])
+
def test_utf_8_decoding_annotation(self):
from rpython.rlib.runicode import str_decode_utf_8
def errorhandler(errors, encoding, msg, s,
More information about the pypy-commit
mailing list