Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r90298:7921b4d69cc7
Date: 2017-02-22 15:37 +0100
http://bitbucket.org/pypy/pypy/changeset/7921b4d69cc7/

Log:    hg merge default

diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -1468,7 +1468,7 @@
         w_level = get_field(space, w_node, 'level', True)
         w_lineno = get_field(space, w_node, 'lineno', False)
         w_col_offset = get_field(space, w_node, 'col_offset', False)
-        _module = space.text_or_None_w(w_module)
+        _module = space.text_or_none_w(w_module)
         names_w = space.unpackiterable(w_names)
         _names = [alias.from_object(space, w_item) for w_item in names_w]
         _level = space.int_w(w_level)
@@ -3777,7 +3777,7 @@
         w_lineno = get_field(space, w_node, 'lineno', False)
         w_col_offset = get_field(space, w_node, 'col_offset', False)
         _type = expr.from_object(space, w_type)
-        _name = space.text_or_None_w(w_name)
+        _name = space.text_or_none_w(w_name)
         body_w = space.unpackiterable(w_body)
         _body = [stmt.from_object(space, w_item) for w_item in body_w]
         _lineno = space.int_w(w_lineno)
@@ -3946,7 +3946,7 @@
     def from_object(space, w_node):
         w_arg = get_field(space, w_node, 'arg', True)
         w_value = get_field(space, w_node, 'value', False)
-        _arg = space.text_or_None_w(w_arg)
+        _arg = space.text_or_none_w(w_arg)
         _value = expr.from_object(space, w_value)
         if _value is None:
             raise_required_value(space, w_node, 'value')
@@ -3981,7 +3981,7 @@
         _name = space.identifier_w(w_name)
         if _name is None:
             raise_required_value(space, w_node, 'name')
-        _asname = space.text_or_None_w(w_asname)
+        _asname = space.text_or_none_w(w_asname)
         return alias(_name, _asname)
 
 State.ast_type('alias', 'AST', ['name', 'asname'])
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -161,7 +161,7 @@
             return "check_string(space, %s)" % (value,)
         elif field.type in ("identifier",):
             if field.opt:
-                return "space.text_or_None_w(%s)" % (value,)
+                return "space.text_or_none_w(%s)" % (value,)
             return "space.identifier_w(%s)" % (value,)
         elif field.type in ("int",):
             return "space.int_w(%s)" % (value,)
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1580,8 +1580,7 @@
                 raise
         return self.buffer_w(w_obj, flags).as_str()
 
-
-    def text_or_None_w(self, w_obj):
+    def text_or_none_w(self, w_obj):
         return None if self.is_none(w_obj) else self.text_w(w_obj)
 
     @not_rpython    # tests only; should be replaced with bytes_w or text_w
@@ -1630,6 +1629,9 @@
                         "argument must be a string without NUL characters")
         return rstring.assert_str0(result)
 
+    def fsencode_or_none_w(self, w_obj):
+        return None if self.is_none(w_obj) else self.fsencode_w(w_obj)
+
     def int_w(self, w_obj, allow_conversion=True):
         """
         Unwrap an app-level int object into an interpret-level int.
@@ -1677,13 +1679,6 @@
                         "characters")
         return rstring.assert_str0(result)
 
-    def realunicode_w(self, w_obj):
-        # Like unicode_w, but only works if w_obj is really of type
-        # 'unicode'.
-        if not self.isinstance_w(w_obj, self.w_unicode):
-            raise oefmt(self.w_TypeError, "argument must be a unicode")
-        return self.unicode_w(w_obj)
-
     def text_w(self, w_obj):
         """
         Unwrap a unicode object and return a 'utf-8-nosg' byte string
@@ -1692,6 +1687,9 @@
         """
         return w_obj.text_w(self)
 
+    realtext_w = text_w         # Python 2 compatibility
+    realunicode_w = unicode_w
+
     def identifier_w(self, w_obj):
         """
         Unwrap an object which is used as an identifier (i.e. names of
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -156,10 +156,7 @@
     def visit_bufferstr(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
-    def visit_str_or_None(self, el, app_sig):   # XXX kill me
-        self.checked_space_method(el, app_sig)
-
-    def visit_text_or_None(self, el, app_sig):
+    def visit_text_or_none(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
     def visit_bytes(self, el, app_sig):
@@ -177,6 +174,9 @@
     def visit_fsencode(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
+    def visit_fsencode_or_none(self, el, app_sig):
+        self.checked_space_method(el, app_sig)
+
     def visit_nonnegint(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
@@ -305,11 +305,8 @@
     def visit_bufferstr(self, typ):
         self.run_args.append("space.bufferstr_w(%s)" % (self.scopenext(),))
 
-    def visit_str_or_None(self, typ):  #XXX kill me
-        self.run_args.append("space.text_or_None_w(%s)" % (self.scopenext(),))
-
-    def visit_text_or_None(self, typ):
-        self.run_args.append("space.text_or_None_w(%s)" % (self.scopenext(),))
+    def visit_text_or_none(self, typ):
+        self.run_args.append("space.text_or_none_w(%s)" % (self.scopenext(),))
 
     def visit_bytes(self, typ):
         self.run_args.append("space.bytes_w(%s)" % (self.scopenext(),))
@@ -326,6 +323,9 @@
     def visit_fsencode(self, typ):
         self.run_args.append("space.fsencode_w(%s)" % (self.scopenext(),))
 
+    def visit_fsencode_or_none(self, typ):
+        self.run_args.append("space.fsencode_or_none_w(%s)" % 
(self.scopenext(),))
+
     def visit_nonnegint(self, typ):
         self.run_args.append("space.gateway_nonnegint_w(%s)" % (
             self.scopenext(),))
@@ -473,11 +473,8 @@
     def visit_bufferstr(self, typ):
         self.unwrap.append("space.bufferstr_w(%s)" % (self.nextarg(),))
 
-    def visit_str_or_None(self, typ):  #XXX kill me
-        self.unwrap.append("space.text_or_None_w(%s)" % (self.nextarg(),))
-
-    def visit_text_or_None(self, typ):
-        self.unwrap.append("space.text_or_None_w(%s)" % (self.nextarg(),))
+    def visit_text_or_none(self, typ):
+        self.unwrap.append("space.text_or_none_w(%s)" % (self.nextarg(),))
 
     def visit_bytes(self, typ):
         self.unwrap.append("space.bytes_w(%s)" % (self.nextarg(),))
@@ -494,6 +491,9 @@
     def visit_fsencode(self, typ):
         self.unwrap.append("space.fsencode_w(%s)" % (self.nextarg(),))
 
+    def visit_fsencode_or_none(self, typ):
+        self.unwrap.append("space.fsencode_or_none_w(%s)" % (self.nextarg(),))
+
     def visit_nonnegint(self, typ):
         self.unwrap.append("space.gateway_nonnegint_w(%s)" % (self.nextarg(),))
 
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -25,7 +25,7 @@
 
 # helper
 
-def unpack_text_tuple(space,w_str_tuple):
+def unpack_text_tuple(space, w_str_tuple):
     return [space.text_w(w_el) for w_el in space.unpackiterable(w_str_tuple)]
 
 
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -384,7 +384,7 @@
             return space.wrap(s0+s1)
         app_g3_ss = gateway.interp2app_temp(g3_ss,
                                          unwrap_spec=[gateway.ObjSpace,
-                                                      'text', 'str_or_None'])
+                                                      'text', 'text_or_none'])
         w_app_g3_ss = space.wrap(app_g3_ss)
         assert self.space.eq_w(
             space.call(w_app_g3_ss,
diff --git a/pypy/module/_cffi_backend/ffi_obj.py 
b/pypy/module/_cffi_backend/ffi_obj.py
--- a/pypy/module/_cffi_backend/ffi_obj.py
+++ b/pypy/module/_cffi_backend/ffi_obj.py
@@ -572,7 +572,7 @@
         return self.ffi_type(w_arg, ACCEPT_STRING | ACCEPT_CDATA)
 
 
-    @unwrap_spec(filename="str_or_None", flags=int)
+    @unwrap_spec(filename="fsencode_or_none", flags=int)
     def descr_dlopen(self, filename, flags=0):
         """\
 Load and return a dynamic library identified by 'name'.  The standard
diff --git a/pypy/module/_cffi_backend/libraryobj.py 
b/pypy/module/_cffi_backend/libraryobj.py
--- a/pypy/module/_cffi_backend/libraryobj.py
+++ b/pypy/module/_cffi_backend/libraryobj.py
@@ -91,7 +91,7 @@
 W_Library.typedef.acceptable_as_base_class = False
 
 
-@unwrap_spec(filename="str_or_None", flags=int)
+@unwrap_spec(filename="fsencode_or_none", flags=int)
 def load_library(space, filename, flags=0):
     lib = W_Library(space, filename, flags)
     return lib
diff --git a/pypy/module/_codecs/interp_codecs.py 
b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -539,7 +539,7 @@
     w_encoder = space.getitem(lookup_codec(space, encoding), space.newint(0))
     return _call_codec(space, w_encoder, w_obj, "encoding", encoding, errors)
 
-@unwrap_spec(errors='str_or_None')
+@unwrap_spec(errors='text_or_none')
 def readbuffer_encode(space, w_data, errors='strict'):
     s = space.getarg_w('s#', w_data)
     return space.newtuple([space.newbytes(s), space.newint(len(s))])
@@ -618,7 +618,7 @@
 def make_encoder_wrapper(name):
     rname = "unicode_encode_%s" % (name.replace("_encode", ""), )
     assert hasattr(runicode, rname)
-    @unwrap_spec(uni=unicode, errors='str_or_None')
+    @unwrap_spec(uni=unicode, errors='text_or_none')
     def wrap_encoder(space, uni, errors="strict"):
         if errors is None:
             errors = 'strict'
@@ -632,7 +632,7 @@
 def make_decoder_wrapper(name):
     rname = "str_decode_%s" % (name.replace("_decode", ""), )
     assert hasattr(runicode, rname)
-    @unwrap_spec(string='bufferstr', errors='str_or_None',
+    @unwrap_spec(string='bufferstr', errors='text_or_none',
                  w_final=WrappedDefault(False))
     def wrap_decoder(space, string, errors="strict", w_final=None):
         if errors is None:
@@ -677,7 +677,7 @@
 if hasattr(runicode, 'str_decode_mbcs'):
     # mbcs functions are not regular, because we have to pass
     # "force_ignore/replace=False"
-    @unwrap_spec(uni=unicode, errors='str_or_None')
+    @unwrap_spec(uni=unicode, errors='text_or_none')
     def mbcs_encode(space, uni, errors="strict"):
         if errors is None:
             errors = 'strict'
@@ -687,7 +687,7 @@
             force_replace=False)
         return space.newtuple([space.newbytes(result), space.newint(len(uni))])
 
-    @unwrap_spec(string='bufferstr', errors='str_or_None',
+    @unwrap_spec(string='bufferstr', errors='text_or_none',
                  w_final=WrappedDefault(False))
     def mbcs_decode(space, string, errors="strict", w_final=None):
         if errors is None:
@@ -702,7 +702,7 @@
 
 # utf-8 functions are not regular, because we have to pass
 # "allow_surrogates=False"
-@unwrap_spec(uni=unicode, errors='str_or_None')
+@unwrap_spec(uni=unicode, errors='text_or_none')
 def utf_8_encode(space, uni, errors="strict"):
     if errors is None:
         errors = 'strict'
@@ -715,7 +715,7 @@
         allow_surrogates=False)
     return space.newtuple([space.newbytes(result), space.newint(len(uni))])
 
-@unwrap_spec(string='bufferstr', errors='str_or_None',
+@unwrap_spec(string='bufferstr', errors='text_or_none',
              w_final = WrappedDefault(False))
 def utf_8_decode(space, string, errors="strict", w_final=None):
     if errors is None:
@@ -731,7 +731,7 @@
         allow_surrogates=False)
     return space.newtuple([space.newunicode(result), space.newint(consumed)])
 
-@unwrap_spec(data='bufferstr', errors='str_or_None', byteorder=int,
+@unwrap_spec(data='bufferstr', errors='text_or_none', byteorder=int,
              w_final=WrappedDefault(False))
 def utf_16_ex_decode(space, data, errors='strict', byteorder=0, w_final=None):
     if errors is None:
@@ -752,7 +752,7 @@
     return space.newtuple([space.newunicode(res), space.newint(consumed),
                            space.newint(byteorder)])
 
-@unwrap_spec(data='bufferstr', errors='str_or_None', byteorder=int,
+@unwrap_spec(data='bufferstr', errors='text_or_none', byteorder=int,
              w_final=WrappedDefault(False))
 def utf_32_ex_decode(space, data, errors='strict', byteorder=0, w_final=None):
     final = space.is_true(w_final)
@@ -850,7 +850,7 @@
             "character mapping must return integer, bytes or None, not str")
 
 
-@unwrap_spec(string='bufferstr', errors='str_or_None')
+@unwrap_spec(string='bufferstr', errors='text_or_none')
 def charmap_decode(space, string, errors="strict", w_mapping=None):
     if errors is None:
         errors = 'strict'
@@ -869,7 +869,7 @@
         final, state.decode_error_handler, mapping)
     return space.newtuple([space.newunicode(result), space.newint(consumed)])
 
-@unwrap_spec(uni=unicode, errors='str_or_None')
+@unwrap_spec(uni=unicode, errors='text_or_none')
 def charmap_encode(space, uni, errors="strict", w_mapping=None):
     if errors is None:
         errors = 'strict'
@@ -912,7 +912,7 @@
             return -1
         return space.int_w(w_code)
 
-@unwrap_spec(errors='str_or_None', w_final=WrappedDefault(False))
+@unwrap_spec(errors='text_or_none', w_final=WrappedDefault(False))
 def unicode_escape_decode(space, w_string, errors="strict", w_final=None):
     string = space.getarg_w('s*', w_string).as_str()
     if errors is None:
@@ -932,7 +932,7 @@
 # ____________________________________________________________
 # Raw Unicode escape (accepts bytes or str)
 
-@unwrap_spec(errors='str_or_None', w_final=WrappedDefault(False))
+@unwrap_spec(errors='text_or_none', w_final=WrappedDefault(False))
 def raw_unicode_escape_decode(space, w_string, errors="strict", w_final=None):
     string = space.getarg_w('s*', w_string).as_str()
     if errors is None:
@@ -947,7 +947,7 @@
 # ____________________________________________________________
 # Unicode-internal
 
-@unwrap_spec(errors='str_or_None')
+@unwrap_spec(errors='text_or_none')
 def unicode_internal_decode(space, w_string, errors="strict"):
     if errors is None:
         errors = 'strict'
@@ -969,7 +969,7 @@
         final, state.decode_error_handler)
     return space.newtuple([space.newunicode(result), space.newint(consumed)])
 
-@unwrap_spec(errors='str_or_None')
+@unwrap_spec(errors='text_or_none')
 def unicode_internal_encode(space, w_uni, errors="strict"):
     space.warn(space.newtext("unicode_internal codec has been deprecated"),
                space.w_DeprecationWarning)
@@ -990,13 +990,13 @@
 # support for the "string escape" translation
 # This is a bytes-to bytes transformation
 
-@unwrap_spec(data='bytes', errors='str_or_None')
+@unwrap_spec(data='bytes', errors='text_or_none')
 def escape_encode(space, data, errors='strict'):
     from pypy.objspace.std.bytesobject import string_escape_encode
     result = string_escape_encode(data, False)
     return space.newtuple([space.newbytes(result), space.newint(len(data))])
 
-@unwrap_spec(errors='str_or_None')
+@unwrap_spec(errors='text_or_none')
 def escape_decode(space, w_data, errors='strict'):
     data = space.getarg_w('s#', w_data)
     from pypy.interpreter.pyparser.parsestring import PyString_DecodeEscape
diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -15,8 +15,8 @@
             space.newtuple([space.w_ValueError, space.w_IOError]))
 
 @unwrap_spec(mode='text', buffering=int,
-             encoding="str_or_None", errors="str_or_None",
-             newline="str_or_None", closefd=int)
+             encoding="text_or_none", errors="text_or_none",
+             newline="text_or_none", closefd=int)
 def open(space, w_file, mode="r", buffering=-1, encoding=None, errors=None,
          newline=None, closefd=True, w_opener=None):
     from pypy.module._io.interp_bufferedio import (W_BufferedRandom,
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -374,7 +374,7 @@
                                               # of the stream
         self.snapshot = None
 
-    @unwrap_spec(encoding="str_or_None", line_buffering=int, write_through=int)
+    @unwrap_spec(encoding="text_or_none", line_buffering=int, 
write_through=int)
     def descr_init(self, space, w_buffer, encoding=None,
                    w_errors=None, w_newline=None, line_buffering=0,
                    write_through=0):
diff --git a/pypy/module/_multibytecodec/interp_incremental.py 
b/pypy/module/_multibytecodec/interp_incremental.py
--- a/pypy/module/_multibytecodec/interp_incremental.py
+++ b/pypy/module/_multibytecodec/interp_incremental.py
@@ -69,7 +69,7 @@
         return space.newunicode(output)
 
 
-@unwrap_spec(errors="str_or_None")
+@unwrap_spec(errors="text_or_none")
 def mbidecoder_new(space, w_subtype, errors=None):
     r = space.allocate_instance(MultibyteIncrementalDecoder, w_subtype)
     r.__init__(space, errors)
@@ -118,7 +118,7 @@
         return space.newbytes(output)
 
 
-@unwrap_spec(errors="str_or_None")
+@unwrap_spec(errors="text_or_none")
 def mbiencoder_new(space, w_subtype, errors=None):
     r = space.allocate_instance(MultibyteIncrementalEncoder, w_subtype)
     r.__init__(space, errors)
diff --git a/pypy/module/_multibytecodec/interp_multibytecodec.py 
b/pypy/module/_multibytecodec/interp_multibytecodec.py
--- a/pypy/module/_multibytecodec/interp_multibytecodec.py
+++ b/pypy/module/_multibytecodec/interp_multibytecodec.py
@@ -11,7 +11,7 @@
         self.name = name
         self.codec = codec
 
-    @unwrap_spec(input='bufferstr', errors="str_or_None")
+    @unwrap_spec(input='bufferstr', errors="text_or_none")
     def decode(self, space, input, errors=None):
         if errors is None:
             errors = 'strict'
@@ -27,7 +27,7 @@
         return space.newtuple([space.newunicode(output),
                                space.newint(len(input))])
 
-    @unwrap_spec(input=unicode, errors="str_or_None")
+    @unwrap_spec(input=unicode, errors="text_or_none")
     def encode(self, space, input, errors=None):
         if errors is None:
             errors = 'strict'
diff --git a/pypy/module/_multiprocessing/interp_semaphore.py 
b/pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py
+++ b/pypy/module/_multiprocessing/interp_semaphore.py
@@ -525,7 +525,7 @@
     def after_fork(self):
         self.count = 0
 
-    @unwrap_spec(kind=int, maxvalue=int, name='text_or_None')
+    @unwrap_spec(kind=int, maxvalue=int, name='text_or_none')
     def rebuild(space, w_cls, w_handle, kind, maxvalue, name):
         #
         if sys_platform != 'win32' and name is not None:
diff --git a/pypy/module/_rawffi/alt/interp_funcptr.py 
b/pypy/module/_rawffi/alt/interp_funcptr.py
--- a/pypy/module/_rawffi/alt/interp_funcptr.py
+++ b/pypy/module/_rawffi/alt/interp_funcptr.py
@@ -344,7 +344,7 @@
     def getidentifier(self, space):
         return space.newint(self.cdll.getidentifier())
 
-@unwrap_spec(name='str_or_None', mode=int)
+@unwrap_spec(name='fsencode_or_none', mode=int)
 def descr_new_cdll(space, w_type, name, mode=-1):
     return W_CDLL(space, name, mode)
 
@@ -363,7 +363,7 @@
         W_CDLL.__init__(self, space, name, mode)
         self.flags = libffi.FUNCFLAG_STDCALL
 
-@unwrap_spec(name='str_or_None', mode=int)
+@unwrap_spec(name='fsencode_or_none', mode=int)
 def descr_new_windll(space, w_type, name, mode=-1):
     return W_WinDLL(space, name, mode)
 
diff --git a/pypy/module/_rawffi/interp_rawffi.py 
b/pypy/module/_rawffi/interp_rawffi.py
--- a/pypy/module/_rawffi/interp_rawffi.py
+++ b/pypy/module/_rawffi/interp_rawffi.py
@@ -242,7 +242,7 @@
     except OSError as e:
         raise wrap_oserror(space, e)
 
-@unwrap_spec(name='str_or_None')
+@unwrap_spec(name='fsencode_or_none')
 def descr_new_cdll(space, w_type, name):
     cdll = open_cdll(space, name)
     return W_CDLL(space, name, cdll)
diff --git a/pypy/module/_winreg/interp_winreg.py 
b/pypy/module/_winreg/interp_winreg.py
--- a/pypy/module/_winreg/interp_winreg.py
+++ b/pypy/module/_winreg/interp_winreg.py
@@ -688,7 +688,7 @@
 
 The return value is the handle of the opened key.
 If the function fails, an EnvironmentError exception is raised."""
-    machine = space.str_or_None_w(w_machine)
+    machine = space.text_or_none_w(w_machine)
     hkey = hkey_w(w_hkey, space)
     with lltype.scoped_alloc(rwinreg.PHKEY.TO, 1) as rethkey:
         ret = rwinreg.RegConnectRegistry(machine, hkey, rethkey)
diff --git a/pypy/module/cpyext/test/test_cpyext.py 
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -315,8 +315,8 @@
 
             return space.wrap(pydname)
 
-        @unwrap_spec(name='text', init='str_or_None', body='text',
-                     filename='str_or_None', PY_SSIZE_T_CLEAN=bool)
+        @unwrap_spec(name='text', init='text_or_none', body='text',
+                     filename='fsencode_or_none', PY_SSIZE_T_CLEAN=bool)
         def import_module(space, name, init=None, body='',
                           filename=None, w_include_dirs=None,
                           PY_SSIZE_T_CLEAN=False):
diff --git a/pypy/module/exceptions/interp_exceptions.py 
b/pypy/module/exceptions/interp_exceptions.py
--- a/pypy/module/exceptions/interp_exceptions.py
+++ b/pypy/module/exceptions/interp_exceptions.py
@@ -358,7 +358,7 @@
         space.realunicode_w(w_object)
         space.int_w(w_start)
         space.int_w(w_end)
-        space.text_w(w_reason)
+        space.realtext_w(w_reason)
         # assign attributes
         self.w_object = w_object
         self.w_start = w_start
@@ -908,11 +908,11 @@
             w_bytes = space.newbytes(space.bufferstr_w(w_object))
         else:
             w_bytes = w_object
-        space.text_w(w_encoding)
+        space.realtext_w(w_encoding)
         space.bytes_w(w_bytes)
         space.int_w(w_start)
         space.int_w(w_end)
-        space.text_w(w_reason)
+        space.realtext_w(w_reason)
         # assign attributes
         self.w_encoding = w_encoding
         self.w_object = w_bytes
@@ -1001,11 +1001,11 @@
 
     def descr_init(self, space, w_encoding, w_object, w_start, w_end, 
w_reason):
         # typechecking
-        space.text_w(w_encoding)
+        space.realtext_w(w_encoding)
         space.realunicode_w(w_object)
         space.int_w(w_start)
         space.int_w(w_end)
-        space.text_w(w_reason)
+        space.realtext_w(w_reason)
         # assign attributes
         self.w_encoding = w_encoding
         self.w_object = w_object
diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -206,7 +206,7 @@
         # we ignore w_type and always return a bytearray
         return new_bytearray(space, space.w_bytearray, data)
 
-    @unwrap_spec(encoding='text_or_None', errors='text_or_None')
+    @unwrap_spec(encoding='text_or_none', errors='text_or_none')
     def descr_init(self, space, w_source=None, encoding=None, errors=None):
         assert isinstance(self, W_BytearrayObject)
         data = [c for c in newbytesdata_w(space, w_source, encoding, errors)]
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -526,7 +526,7 @@
         return space.newlist_bytes(lst)
 
     @staticmethod
-    @unwrap_spec(encoding='text_or_None', errors='text_or_None')
+    @unwrap_spec(encoding='text_or_none', errors='text_or_none')
     def descr_new(space, w_stringtype, w_source=None, encoding=None,
                   errors=None):
         if (w_source and space.is_w(w_stringtype, space.w_bytes)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to