[pypy-commit] pypy py3.5: fix

arigo pypy.commits at gmail.com
Sun Feb 12 04:40:40 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r90067:794944a8179b
Date: 2017-02-12 10:24 +0100
http://bitbucket.org/pypy/pypy/changeset/794944a8179b/

Log:	fix

diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -54,7 +54,7 @@
         with scoped_unicode2rawwcharp(u) as ubuf:
             sbuf = pypy_wchar2char(ubuf, errorposp)
         try:
-            if sbuf is None:
+            if not sbuf:
                 errorpos = rffi.cast(lltype.Signed, errorposp[0])
                 if errorpos == -1:
                     raise MemoryError
@@ -80,7 +80,7 @@
         with rffi.scoped_str2charp(s) as sbuf:
             ubuf = pypy_char2wchar(sbuf, sizep)
         try:
-            if ubuf is None:
+            if not ubuf:
                 errmsg = _errmsg(u"pypy_char2wchar")
                 errorhandler('strict', 'filesystemencoding', errmsg, s, 0, 1)
             size = rffi.cast(lltype.Signed, sizep[0])
@@ -90,9 +90,8 @@
 
 
 def _errmsg(what):
-    from rpython.rlib import rposix
-    errmsg = _strerror(rposix.get_errno())
-    return u"%s failed" % what if errmsg is None else errmsg
+    # I *think* that the functions in locale_codec.c don't set errno
+    return u"%s failed" % what
 
 
 class scoped_unicode2rawwcharp:


More information about the pypy-commit mailing list