Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r96112:20b185cf3f0c
Date: 2019-02-20 11:03 +0200
http://bitbucket.org/pypy/pypy/changeset/20b185cf3f0c/

Log:    fixes

diff --git a/pypy/module/_cffi_backend/errorbox.py 
b/pypy/module/_cffi_backend/errorbox.py
--- a/pypy/module/_cffi_backend/errorbox.py
+++ b/pypy/module/_cffi_backend/errorbox.py
@@ -90,7 +90,8 @@
 
             w_text = self.space.call_function(w_done)
             p = rffi.utf82wcharp(self.space.utf8_w(w_text),
-                                    track_allocation=False)
+                                 self.space.len_w(w_text),
+                                 track_allocation=False)
             if self.text_p:
                 rffi.free_wcharp(self.text_p, track_allocation=False)
             self.text_p = p      # keepalive
diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -488,7 +488,7 @@
                                 "or str")
             try:
                 builder.append_code(codepoint)
-            except ValueError:
+            except rutf8.OutOfRange:
                 raise oefmt(space.w_ValueError,
                             "character mapping must be in range(0x110000)")
         return self.from_utf8builder(builder)
@@ -1927,7 +1927,7 @@
                 pass
         try:
             c = rutf8.unichr_as_utf8(r_uint(uchr))
-        except ValueError:
+        except rutf8.OutOfRange:
             w_encoding = space.newtext('utf-8')
             w_start = space.newint(pos)
             w_end = space.newint(pos+1)
diff --git a/rpython/rlib/test/test_rutf8.py b/rpython/rlib/test/test_rutf8.py
--- a/rpython/rlib/test/test_rutf8.py
+++ b/rpython/rlib/test/test_rutf8.py
@@ -200,7 +200,7 @@
 
 def test_utf8_string_builder_bad_code():
     s = rutf8.Utf8StringBuilder()
-    with pytest.raises(ValueError):
+    with pytest.raises(rutf8.OutOfRange):
         s.append_code(0x110000)
     assert s.build() == ''
     assert s.getlength() == 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to