Author: Armin Rigo <[email protected]>
Branch:
Changeset: r90321:1c47dc995f88
Date: 2017-02-23 12:32 +0100
http://bitbucket.org/pypy/pypy/changeset/1c47dc995f88/
Log: merge heads
diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -5,7 +5,7 @@
from rpython.rlib.unicodedata import unicodedb
from rpython.tool.sourcetools import func_with_new_name
from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib import jit
+from rpython.rlib import jit, nonconst
if rffi.sizeof(lltype.UniChar) == 4:
@@ -373,7 +373,12 @@
pos += 1
_encodeUCS4(result, ch3)
continue
- if not allow_surrogates:
+ # note: if the program only ever calls this with
+ # allow_surrogates=True, then we'll never annotate
+ # the following block of code, and errorhandler()
+ # will never be called. This causes RPython
+ # problems. Avoid it with the nonconst hack.
+ if not allow_surrogates or nonconst.NonConstant(False):
ru, rs, pos = errorhandler(errors, 'utf8',
'surrogates not allowed',
s, pos-1, pos)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit