Author: Armin Rigo <ar...@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:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to