[pypy-commit] pypy space-newtext: more str unwrap_spec removed

cfbolz pypy.commits at gmail.com
Tue Dec 6 10:06:45 EST 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: space-newtext
Changeset: r88907:5016301ea5c3
Date: 2016-12-06 16:06 +0100
http://bitbucket.org/pypy/pypy/changeset/5016301ea5c3/

Log:	more str unwrap_spec removed

diff --git a/pypy/module/__pypy__/interp_builders.py b/pypy/module/__pypy__/interp_builders.py
--- a/pypy/module/__pypy__/interp_builders.py
+++ b/pypy/module/__pypy__/interp_builders.py
@@ -7,6 +7,10 @@
 
 
 def create_builder(name, strtype, builder_cls, newmethod):
+    if strtype is str:
+        unwrap = 'bytes'
+    else:
+        unwrap = unicode
     class W_Builder(W_Root):
         def __init__(self, space, size):
             if size < 0:
@@ -23,12 +27,12 @@
         def descr__new__(space, w_subtype, size=-1):
             return W_Builder(space, size)
 
-        @unwrap_spec(s=strtype)
+        @unwrap_spec(s=unwrap)
         def descr_append(self, space, s):
             self._check_done(space)
             self.builder.append(s)
 
-        @unwrap_spec(s=strtype, start=int, end=int)
+        @unwrap_spec(s=unwrap, start=int, end=int)
         def descr_append_slice(self, space, s, start, end):
             self._check_done(space)
             if not 0 <= start <= end <= len(s):
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
@@ -174,7 +174,7 @@
                     m1, s12, m2, s23, m3, w_x)
 
 
-    @unwrap_spec(module_name=str, _version=int, _types=str)
+    @unwrap_spec(module_name='text', _version=int, _types='text')
     def descr_init(self, module_name='?', _version=-1, _types='',
                    w__globals=None, w__struct_unions=None, w__enums=None,
                    w__typenames=None, w__includes=None):
@@ -377,7 +377,7 @@
         return w_cdata.with_gc(w_destructor)
 
 
-    @unwrap_spec(replace_with=str)
+    @unwrap_spec(replace_with='text')
     def descr_getctype(self, w_cdecl, replace_with=''):
         """\
 Return a string giving the C type 'cdecl', which may be itself a
@@ -614,7 +614,7 @@
         lib.cdlopen_close()
 
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def descr_integer_const(self, name):
         """\
 Get the value of an integer constant.
diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py
--- a/pypy/module/_cffi_backend/func.py
+++ b/pypy/module/_cffi_backend/func.py
@@ -64,7 +64,7 @@
 
 # ____________________________________________________________
 
- at unwrap_spec(w_ctype=ctypeobj.W_CType, replace_with=str)
+ at unwrap_spec(w_ctype=ctypeobj.W_CType, replace_with='text')
 def getcname(space, w_ctype, replace_with):
     p = w_ctype.name_position
     s = '%s%s%s' % (w_ctype.name[:p], replace_with, w_ctype.name[p:])
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
@@ -38,7 +38,7 @@
         space = self.space
         return space.newtext("<clibrary '%s'>" % self.name)
 
-    @unwrap_spec(w_ctype=W_CType, name=str)
+    @unwrap_spec(w_ctype=W_CType, name='text')
     def load_function(self, w_ctype, name):
         from pypy.module._cffi_backend import ctypefunc, ctypeptr, ctypevoid
         space = self.space
@@ -61,7 +61,7 @@
                         name, self.name)
         return W_CData(space, rffi.cast(rffi.CCHARP, cdata), w_ctype)
 
-    @unwrap_spec(w_ctype=W_CType, name=str)
+    @unwrap_spec(w_ctype=W_CType, name='text')
     def read_variable(self, w_ctype, name):
         space = self.space
         try:
@@ -72,7 +72,7 @@
                         name, self.name)
         return w_ctype.convert_to_object(rffi.cast(rffi.CCHARP, cdata))
 
-    @unwrap_spec(w_ctype=W_CType, name=str)
+    @unwrap_spec(w_ctype=W_CType, name='text')
     def write_variable(self, w_ctype, name, w_value):
         space = self.space
         try:
diff --git a/pypy/module/_cffi_backend/newtype.py b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -132,7 +132,7 @@
     eptypesize("int_fast64_t",  8, _WCTSigned)
     eptypesize("uint_fast64_t", 8, _WCTUnsign)
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def new_primitive_type(space, name):
     return _new_primitive_type(space, name)
 
@@ -259,11 +259,11 @@
 # ____________________________________________________________
 
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def new_struct_type(space, name):
     return ctypestruct.W_CTypeStruct(space, name)
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def new_union_type(space, name):
     return ctypestruct.W_CTypeUnion(space, name)
 
@@ -562,7 +562,7 @@
 
 # ____________________________________________________________
 
- at unwrap_spec(name=str, w_basectype=ctypeobj.W_CType)
+ at unwrap_spec(name='text', w_basectype=ctypeobj.W_CType)
 def new_enum_type(space, name, w_enumerators, w_enumvalues, w_basectype):
     enumerators_w = space.fixedview(w_enumerators)
     enumvalues_w  = space.fixedview(w_enumvalues)
diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -12,7 +12,7 @@
     """)
 
 # the following function is used e.g. in test_resource_warning
- at unwrap_spec(regex=str, s=str)
+ at unwrap_spec(regex='text', s='text')
 def regex_search(space, regex, s):
     import re
     import textwrap
diff --git a/pypy/module/_hashlib/interp_hashlib.py b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -160,7 +160,7 @@
 )
 W_Hash.typedef.acceptable_as_base_class = False
 
- at unwrap_spec(name=str, string='bufferstr')
+ at unwrap_spec(name='text', string='bufferstr')
 def new(space, name, string=''):
     w_hash = W_Hash(space, name)
     w_hash.update(space, string)
@@ -181,7 +181,7 @@
 
 HAS_FAST_PKCS5_PBKDF2_HMAC = ropenssl.PKCS5_PBKDF2_HMAC is not None
 if HAS_FAST_PKCS5_PBKDF2_HMAC:
-    @unwrap_spec(name=str, password=str, salt=str, rounds=int,
+    @unwrap_spec(name='text', password='bytes', salt='bytes', rounds=int,
                  w_dklen=WrappedDefault(None))
     def pbkdf2_hmac(space, name, password, salt, rounds, w_dklen):
         digest = ropenssl.EVP_get_digestbyname(name)
diff --git a/pypy/module/_locale/interp_locale.py b/pypy/module/_locale/interp_locale.py
--- a/pypy/module/_locale/interp_locale.py
+++ b/pypy/module/_locale/interp_locale.py
@@ -148,7 +148,7 @@
 _strxfrm = rlocale.external('strxfrm',
                     [rffi.CCHARP, rffi.CCHARP, rffi.SIZE_T], rffi.SIZE_T)
 
- at unwrap_spec(s=str)
+ at unwrap_spec(s='text')
 def strxfrm(space, s):
     "string -> string. Returns a string that behaves for cmp locale-aware."
     n1 = len(s) + 1
@@ -193,7 +193,7 @@
 if rlocale.HAVE_LIBINTL:
     _gettext = rlocale.external('gettext', [rffi.CCHARP], rffi.CCHARP)
 
-    @unwrap_spec(msg=str)
+    @unwrap_spec(msg='text')
     def gettext(space, msg):
         """gettext(msg) -> string
         Return translation of msg."""
@@ -205,7 +205,7 @@
 
     _dgettext = rlocale.external('dgettext', [rffi.CCHARP, rffi.CCHARP], rffi.CCHARP)
 
-    @unwrap_spec(msg=str)
+    @unwrap_spec(msg='text')
     def dgettext(space, w_domain, msg):
         """dgettext(domain, msg) -> string
         Return translation of msg in domain."""
@@ -239,7 +239,7 @@
     _dcgettext = rlocale.external('dcgettext', [rffi.CCHARP, rffi.CCHARP, rffi.INT],
                                                                 rffi.CCHARP)
 
-    @unwrap_spec(msg=str, category=int)
+    @unwrap_spec(msg='text', category=int)
     def dcgettext(space, w_domain, msg, category):
         """dcgettext(domain, msg, category) -> string
         Return translation of msg in domain and category."""
@@ -301,7 +301,7 @@
                                                                 rffi.CCHARP,
                                        save_err=rffi.RFFI_SAVE_ERRNO)
 
-    @unwrap_spec(domain=str)
+    @unwrap_spec(domain='text')
     def bindtextdomain(space, domain, w_dir):
         """bindtextdomain(domain, dir) -> string
         Bind the C library's domain to dir."""
@@ -332,7 +332,7 @@
                                     [rffi.CCHARP, rffi.CCHARP], rffi.CCHARP)
 
     if rlocale.HAVE_BIND_TEXTDOMAIN_CODESET:
-        @unwrap_spec(domain=str)
+        @unwrap_spec(domain='text')
         def bind_textdomain_codeset(space, domain, w_codeset):
             """bind_textdomain_codeset(domain, codeset) -> string
             Bind the C library's domain to codeset."""
diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py
--- a/pypy/module/_minimal_curses/interp_curses.py
+++ b/pypy/module/_minimal_curses/interp_curses.py
@@ -75,7 +75,7 @@
     except _curses.error as e:
         raise curses_error(e.args[0])
 
- at unwrap_spec(capname=str)
+ at unwrap_spec(capname='text')
 def tigetstr(space, capname):
     try:
         result = _curses_tigetstr(capname)
@@ -85,7 +85,7 @@
         raise convert_error(space, e)
     return space.newbytes(result)
 
- at unwrap_spec(s=str)
+ at unwrap_spec(s='text')
 def tparm(space, s, args_w):
     args = [space.int_w(a) for a in args_w]
     try:
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
@@ -48,7 +48,7 @@
             c_codecs.pypy_cjk_dec_free(self.decodebuf)
             self.decodebuf = lltype.nullptr(c_codecs.DECODEBUF_P.TO)
 
-    @unwrap_spec(object=str, final=bool)
+    @unwrap_spec(object='bytes', final=bool)
     def decode_w(self, object, final=False):
         space = self.space
         state = space.fromcache(CodecState)
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=str, errors="str_or_None")
+    @unwrap_spec(input='bytes', errors="str_or_None")
     def decode(self, space, input, errors=None):
         if errors is None:
             errors = 'strict'
@@ -52,7 +52,7 @@
 MultibyteCodec.typedef.acceptable_as_base_class = False
 
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def getcodec(space, name):
     try:
         codec = c_codecs.getcodec(name)
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
@@ -52,7 +52,7 @@
             raise oefmt(space.w_TypeError,
                         "function name must be a string or integer")
 else:
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def _getfunc(space, CDLL, w_name, w_argtypes, w_restype):
         name = space.text_w(w_name)
         argtypes_w, argtypes, w_restype, restype = unpack_argtypes(
@@ -287,7 +287,7 @@
     restype = unwrap_ffitype(space, w_restype, allow_void=True)
     return argtypes_w, argtypes, w_restype, restype
 
- at unwrap_spec(addr=r_uint, name=str, flags=int)
+ at unwrap_spec(addr=r_uint, name='text', flags=int)
 def descr_fromaddr(space, w_cls, addr, name, w_argtypes,
                     w_restype, flags=libffi.FUNCFLAG_CDECL):
     argtypes_w, argtypes, w_restype, restype = unpack_argtypes(space,
@@ -331,7 +331,7 @@
     def getfunc(self, space, w_name, w_argtypes, w_restype):
         return _getfunc(space, self, w_name, w_argtypes, w_restype)
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def getaddressindll(self, space, name):
         try:
             address_as_uint = rffi.cast(lltype.Unsigned,
diff --git a/pypy/module/_rawffi/alt/interp_struct.py b/pypy/module/_rawffi/alt/interp_struct.py
--- a/pypy/module/_rawffi/alt/interp_struct.py
+++ b/pypy/module/_rawffi/alt/interp_struct.py
@@ -21,7 +21,7 @@
     def __repr__(self):
         return '<Field %s %s>' % (self.name, self.w_ffitype.name)
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def descr_new_field(space, w_type, name, w_ffitype):
     w_ffitype = space.interp_w(W_FFIType, w_ffitype)
     return W_Field(name, w_ffitype)
@@ -111,7 +111,7 @@
 
 
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def descr_new_structdescr(space, w_type, name, w_fields=None):
     descr = W__StructDescr(name)
     if not space.is_none(w_fields):
@@ -180,14 +180,14 @@
         addr = rffi.cast(rffi.ULONG, self.rawmem)
         return space.newint(addr)
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def getfield(self, space, name):
         w_ffitype, offset = self.structdescr.get_type_and_offset_for_field(
             space, name)
         field_getter = GetFieldConverter(space, self.rawmem, offset)
         return field_getter.do_and_wrap(w_ffitype)
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def setfield(self, space, name, w_value):
         w_ffitype, offset = self.structdescr.get_type_and_offset_for_field(
             space, name)
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
@@ -218,7 +218,7 @@
         space.setitem(self.w_cache, w_key, w_funcptr)
         return w_funcptr
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def getaddressindll(self, space, name):
         try:
             address_as_uint = rffi.cast(lltype.Unsigned,
@@ -562,7 +562,7 @@
 W_FuncPtr.typedef.acceptable_as_base_class = False
 
 def _create_new_accessor(func_name, name):
-    @unwrap_spec(tp_letter=str)
+    @unwrap_spec(tp_letter='text')
     def accessor(space, tp_letter):
         if len(tp_letter) != 1:
             raise oefmt(space.w_ValueError, "Expecting string of length one")
diff --git a/pypy/module/_rawffi/structure.py b/pypy/module/_rawffi/structure.py
--- a/pypy/module/_rawffi/structure.py
+++ b/pypy/module/_rawffi/structure.py
@@ -204,12 +204,12 @@
     def fromaddress(self, space, address):
         return W_StructureInstance(space, self, address)
 
-    @unwrap_spec(attr=str)
+    @unwrap_spec(attr='text')
     def descr_fieldoffset(self, space, attr):
         index = self.getindex(space, attr)
         return space.newint(self.ll_positions[index])
 
-    @unwrap_spec(attr=str)
+    @unwrap_spec(attr='text')
     def descr_fieldsize(self, space, attr):
         index = self.getindex(space, attr)
         if self.ll_bitsizes and index < len(self.ll_bitsizes):
@@ -351,7 +351,7 @@
         addr = rffi.cast(lltype.Unsigned, self.ll_buffer)
         return space.newtext("<_rawffi struct %x>" % (addr,))
 
-    @unwrap_spec(attr=str)
+    @unwrap_spec(attr='text')
     def getattr(self, space, attr):
         if not self.ll_buffer:
             raise segfault_exception(space, "accessing NULL pointer")
@@ -359,7 +359,7 @@
         _, tp, _ = self.shape.fields[i]
         return wrap_value(space, cast_pos, self, i, tp.itemcode)
 
-    @unwrap_spec(attr=str)
+    @unwrap_spec(attr='text')
     def setattr(self, space, attr, w_value):
         if not self.ll_buffer:
             raise segfault_exception(space, "accessing NULL pointer")
@@ -367,7 +367,7 @@
         _, tp, _ = self.shape.fields[i]
         unwrap_value(space, push_field, self, i, tp.itemcode, w_value)
 
-    @unwrap_spec(attr=str)
+    @unwrap_spec(attr='text')
     def descr_fieldaddress(self, space, attr):
         i = self.shape.getindex(space, attr)
         ptr = rffi.ptradd(self.ll_buffer, self.shape.ll_positions[i])
diff --git a/pypy/module/_socket/interp_func.py b/pypy/module/_socket/interp_func.py
--- a/pypy/module/_socket/interp_func.py
+++ b/pypy/module/_socket/interp_func.py
@@ -40,7 +40,7 @@
                            space.newlist(aliases),
                            space.newlist(address_list)])
 
- at unwrap_spec(host=str)
+ at unwrap_spec(host='text')
 def gethostbyname_ex(space, host):
     """gethostbyname_ex(host) -> (name, aliaslist, addresslist)
 
diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -16,7 +16,7 @@
 from pypy.module._file.interp_file import W_File
 
 
- at unwrap_spec(typecode=str)
+ at unwrap_spec(typecode='text')
 def w_array(space, w_cls, typecode, __args__):
     if len(__args__.arguments_w) > 1:
         raise oefmt(space.w_TypeError, "array() takes at most 2 arguments")
diff --git a/pypy/module/bz2/interp_bz2.py b/pypy/module/bz2/interp_bz2.py
--- a/pypy/module/bz2/interp_bz2.py
+++ b/pypy/module/bz2/interp_bz2.py
@@ -249,7 +249,7 @@
             space = self.space
             raise oefmt(space.w_ValueError, "invalid mode: '%s'", mode)
 
-    @unwrap_spec(mode=str, buffering=int, compresslevel=int)
+    @unwrap_spec(mode='text', buffering=int, compresslevel=int)
     def direct_bz2__init__(self, w_name, mode='r', buffering=-1,
                            compresslevel=9):
         self.direct_close()
diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -28,7 +28,7 @@
     def lt(self, a, b):
         return a.priority() < b.priority()
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def load_dictionary(space, name):
     try:
         cdll = capi.c_load_dictionary(name)
@@ -63,11 +63,11 @@
         state.w_nullptr = nullarr
     return state.w_nullptr
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def resolve_name(space, name):
     return space.newtext(capi.c_resolve_name(space, name))
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def scope_byname(space, name):
     true_name = capi.c_resolve_name(space, name)
 
@@ -95,7 +95,7 @@
 
     return None
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def template_byname(space, name):
     state = space.fromcache(State)
     try:
@@ -873,9 +873,9 @@
 W_CPPNamespace.typedef = TypeDef(
     'CPPNamespace',
     get_method_names = interp2app(W_CPPNamespace.get_method_names),
-    get_overload = interp2app(W_CPPNamespace.get_overload, unwrap_spec=['self', str]),
+    get_overload = interp2app(W_CPPNamespace.get_overload, unwrap_spec=['self', 'text']),
     get_datamember_names = interp2app(W_CPPNamespace.get_datamember_names),
-    get_datamember = interp2app(W_CPPNamespace.get_datamember, unwrap_spec=['self', str]),
+    get_datamember = interp2app(W_CPPNamespace.get_datamember, unwrap_spec=['self', 'text']),
     is_namespace = interp2app(W_CPPNamespace.is_namespace),
     __dir__ = interp2app(W_CPPNamespace.ns__dir__),
 )
@@ -960,11 +960,11 @@
     type_name = interp_attrproperty('name', W_CPPClass, wrapfn="newtext"),
     get_base_names = interp2app(W_CPPClass.get_base_names),
     get_method_names = interp2app(W_CPPClass.get_method_names),
-    get_overload = interp2app(W_CPPClass.get_overload, unwrap_spec=['self', str]),
+    get_overload = interp2app(W_CPPClass.get_overload, unwrap_spec=['self', 'text']),
     get_datamember_names = interp2app(W_CPPClass.get_datamember_names),
-    get_datamember = interp2app(W_CPPClass.get_datamember, unwrap_spec=['self', str]),
+    get_datamember = interp2app(W_CPPClass.get_datamember, unwrap_spec=['self', 'text']),
     is_namespace = interp2app(W_CPPClass.is_namespace),
-    dispatch = interp2app(W_CPPClass.dispatch, unwrap_spec=['self', str, str])
+    dispatch = interp2app(W_CPPClass.dispatch, unwrap_spec=['self', 'text', 'text'])
 )
 W_CPPClass.typedef.acceptable_as_base_class = False
 
@@ -987,11 +987,11 @@
     type_name = interp_attrproperty('name', W_CPPClass, wrapfn="newtext"),
     get_base_names = interp2app(W_ComplexCPPClass.get_base_names),
     get_method_names = interp2app(W_ComplexCPPClass.get_method_names),
-    get_overload = interp2app(W_ComplexCPPClass.get_overload, unwrap_spec=['self', str]),
+    get_overload = interp2app(W_ComplexCPPClass.get_overload, unwrap_spec=['self', 'text']),
     get_datamember_names = interp2app(W_ComplexCPPClass.get_datamember_names),
-    get_datamember = interp2app(W_ComplexCPPClass.get_datamember, unwrap_spec=['self', str]),
+    get_datamember = interp2app(W_ComplexCPPClass.get_datamember, unwrap_spec=['self', 'text']),
     is_namespace = interp2app(W_ComplexCPPClass.is_namespace),
-    dispatch = interp2app(W_CPPClass.dispatch, unwrap_spec=['self', str, str])
+    dispatch = interp2app(W_CPPClass.dispatch, unwrap_spec=['self', 'text', 'text'])
 )
 W_ComplexCPPClass.typedef.acceptable_as_base_class = False
 
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -1505,7 +1505,7 @@
     from pypy.module._cffi_backend import cffi1_module
     cffi1_module.load_cffi1_module(space, name, path, initptr)
 
- at unwrap_spec(path=str, name=str)
+ at unwrap_spec(path='text', name='text')
 def load_extension_module(space, path, name):
     # note: this is used both to load CPython-API-style C extension
     # modules (cpyext) and to load CFFI-style extension modules
diff --git a/pypy/module/crypt/interp_crypt.py b/pypy/module/crypt/interp_crypt.py
--- a/pypy/module/crypt/interp_crypt.py
+++ b/pypy/module/crypt/interp_crypt.py
@@ -10,7 +10,7 @@
 c_crypt = rffi.llexternal('crypt', [rffi.CCHARP, rffi.CCHARP], rffi.CCHARP,
                           compilation_info=eci, releasegil=False)
 
- at unwrap_spec(word=str, salt=str)
+ at unwrap_spec(word='text', salt='text')
 def crypt(space, word, salt):
     """word will usually be a user's password. salt is a 2-character string
     which will be used to select one of 4096 variations of DES. The characters
diff --git a/pypy/module/micronumpy/casting.py b/pypy/module/micronumpy/casting.py
--- a/pypy/module/micronumpy/casting.py
+++ b/pypy/module/micronumpy/casting.py
@@ -119,7 +119,7 @@
     return not all_scalars and max_array_kind >= max_scalar_kind
 
 
- at unwrap_spec(casting=str)
+ at unwrap_spec(casting='text')
 def can_cast(space, w_from, w_totype, casting='safe'):
     try:
         target = as_dtype(space, w_totype, allow_None=False)
diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
--- a/pypy/module/micronumpy/ctors.py
+++ b/pypy/module/micronumpy/ctors.py
@@ -519,7 +519,7 @@
     return a
 
 
- at unwrap_spec(s=str, count=int, sep=str, w_dtype=WrappedDefault(None))
+ at unwrap_spec(s='text', count=int, sep='text', w_dtype=WrappedDefault(None))
 def fromstring(space, s, w_dtype=None, count=-1, sep=''):
     dtype = space.interp_w(descriptor.W_Dtype,
         space.call_function(space.gettypefor(descriptor.W_Dtype), w_dtype))
diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
--- a/pypy/module/micronumpy/descriptor.py
+++ b/pypy/module/micronumpy/descriptor.py
@@ -700,7 +700,7 @@
             self.alignment = alignment
         self.flags = flags
 
-    @unwrap_spec(new_order=str)
+    @unwrap_spec(new_order='text')
     def descr_newbyteorder(self, space, new_order=NPY.SWAP):
         newendian = byteorder_converter(space, new_order)
         endian = self.byteorder
diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -714,7 +714,7 @@
         contig = self.implementation.astype(space, dtype, self.get_order())
         return contig.argsort(space, w_axis)
 
-    @unwrap_spec(order=str, casting=str, subok=bool, copy=bool)
+    @unwrap_spec(order='text', casting='text', subok=bool, copy=bool)
     def descr_astype(self, space, w_dtype, order='K', casting='unsafe', subok=True, copy=True):
         cur_dtype = self.get_dtype()
         new_dtype = space.interp_w(descriptor.W_Dtype, space.call_function(
@@ -857,7 +857,7 @@
         raise oefmt(space.w_NotImplementedError,
                     "getfield not implemented yet")
 
-    @unwrap_spec(new_order=str)
+    @unwrap_spec(new_order='text')
     def descr_newbyteorder(self, space, new_order=NPY.SWAP):
         return self.descr_view(
             space, self.get_dtype().descr_newbyteorder(space, new_order))
@@ -931,7 +931,7 @@
         raise oefmt(space.w_NotImplementedError,
                     "setflags not implemented yet")
 
-    @unwrap_spec(kind=str)
+    @unwrap_spec(kind='text')
     def descr_sort(self, space, w_axis=None, kind='quicksort', w_order=None):
         # happily ignore the kind
         # modify the array in-place
diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py
--- a/pypy/module/micronumpy/ufuncs.py
+++ b/pypy/module/micronumpy/ufuncs.py
@@ -1422,8 +1422,8 @@
 def get(space):
     return space.fromcache(UfuncState)
 
- at unwrap_spec(nin=int, nout=int, signature=str, w_identity=WrappedDefault(None),
-             name=str, doc=str, stack_inputs=bool)
+ at unwrap_spec(nin=int, nout=int, signature='text', w_identity=WrappedDefault(None),
+             name='text', doc='text', stack_inputs=bool)
 def frompyfunc(space, w_func, nin, nout, w_dtypes=None, signature='',
      w_identity=None, name='', doc='', stack_inputs=False):
     ''' frompyfunc(func, nin, nout) #cpython numpy compatible
diff --git a/pypy/module/mmap/interp_mmap.py b/pypy/module/mmap/interp_mmap.py
--- a/pypy/module/mmap/interp_mmap.py
+++ b/pypy/module/mmap/interp_mmap.py
@@ -101,7 +101,7 @@
         except RValueError as v:
             raise mmap_error(self.space, v)
 
-    @unwrap_spec(byte=str)
+    @unwrap_spec(byte='bytes')
     def write_byte(self, byte):
         self.check_valid()
         self.check_writeable()
@@ -265,7 +265,7 @@
 
 elif rmmap._MS_WINDOWS:
 
-    @unwrap_spec(fileno=int, length=int, tagname=str,
+    @unwrap_spec(fileno=int, length=int, tagname='text',
                  access=int, offset=OFF_T)
     def mmap(space, w_subtype, fileno, length, tagname="",
              access=rmmap._ACCESS_DEFAULT, offset=0):
diff --git a/pypy/module/parser/pyparser.py b/pypy/module/parser/pyparser.py
--- a/pypy/module/parser/pyparser.py
+++ b/pypy/module/parser/pyparser.py
@@ -48,7 +48,7 @@
         return self._build_app_tree(space, self.tree, space.newlist,
                                     line_info, col_info)
 
-    @unwrap_spec(filename=str)
+    @unwrap_spec(filename='text')
     def descr_compile(self, space, filename="<syntax-tree>"):
         info = pyparse.CompileInfo(filename, self.mode)
         try:
@@ -85,12 +85,12 @@
     return W_STType(tree, mode)
 
 
- at unwrap_spec(source=str)
+ at unwrap_spec(source='text')
 def suite(space, source):
     return parse_python(space, source, 'exec')
 
 
- at unwrap_spec(source=str)
+ at unwrap_spec(source='text')
 def expr(space, source):
     return parse_python(space, source, 'eval')
 
diff --git a/pypy/module/pwd/interp_pwd.py b/pypy/module/pwd/interp_pwd.py
--- a/pypy/module/pwd/interp_pwd.py
+++ b/pypy/module/pwd/interp_pwd.py
@@ -106,7 +106,7 @@
             "%s: %d" % (msg, widen(uid))))
     return make_struct_passwd(space, pw)
 
- at unwrap_spec(name=str)
+ at unwrap_spec(name='text')
 def getpwnam(space, name):
     """
     getpwnam(name) -> (pw_name,pw_passwd,pw_uid,
diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -636,7 +636,7 @@
 
     # Parse methods
 
-    @unwrap_spec(data=str, isfinal=bool)
+    @unwrap_spec(data='text', isfinal=bool)
     def Parse(self, space, data, isfinal=False):
         """Parse(data[, isfinal])
 Parse XML data.  `isfinal' should be true at end of input."""
@@ -663,7 +663,7 @@
             w_res = self.Parse(space, data, isfinal=eof)
         return w_res
 
-    @unwrap_spec(base=str)
+    @unwrap_spec(base='text')
     def SetBase(self, space, base):
         XML_SetBase(self.itself, base)
 
diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -127,15 +127,15 @@
             l_w.append(WrappedOp(name, ofs, logops.repr_of_resop(op)))
     return l_w
 
- at unwrap_spec(offset=int, repr=str, name=str)
+ at unwrap_spec(offset=int, repr='text', name='text')
 def descr_new_resop(space, w_tp, name, offset=-1, repr=''):
     return WrappedOp(name, offset, repr)
 
- at unwrap_spec(offset=int, repr=str, name=str, hash=r_uint)
+ at unwrap_spec(offset=int, repr='text', name='text', hash=r_uint)
 def descr_new_guardop(space, w_tp, name, offset=-1, repr='', hash=r_uint(0)):
     return GuardOp(name, offset, repr, hash)
 
- at unwrap_spec(repr=str, name=str, jd_name=str, call_depth=int, call_id=int)
+ at unwrap_spec(repr='text', name='text', jd_name='text', call_depth=int, call_id=int)
 def descr_new_dmp(space, w_tp, name, repr, jd_name, call_depth, call_id,
     w_greenkey):
 
@@ -291,7 +291,7 @@
 
 
 @unwrap_spec(loopno=int, asmaddr=int, asmlen=int, loop_no=int,
-             type=str, jd_name=str, bridge_no=int)
+             type='text', jd_name='text', bridge_no=int)
 def descr_new_jit_loop_info(space, w_subtype, w_greenkey, w_ops, loopno,
                             asmaddr, asmlen, loop_no, type, jd_name,
                             bridge_no=-1):
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -591,7 +591,7 @@
         # reset timezone, altzone, daylight and tzname
         _init_timezone(space)
 
- at unwrap_spec(format=str)
+ at unwrap_spec(format='text')
 def strftime(space, format, w_tup=None):
     """strftime(format[, tuple]) -> string
 
diff --git a/pypy/module/unicodedata/interp_ucd.py b/pypy/module/unicodedata/interp_ucd.py
--- a/pypy/module/unicodedata/interp_ucd.py
+++ b/pypy/module/unicodedata/interp_ucd.py
@@ -94,7 +94,7 @@
 
         self.version = unicodedb.version
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def _get_code(self, space, name):
         try:
             code = self._lookup(name.upper())
@@ -103,7 +103,7 @@
             raise OperationError(space.w_KeyError, msg)
         return space.newint(code)
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def lookup(self, space, name):
         try:
             code = self._lookup(name.upper())
@@ -177,7 +177,7 @@
         code = unichr_to_code_w(space, w_unichr)
         return space.newtext(self._decomposition(code))
 
-    @unwrap_spec(form=str)
+    @unwrap_spec(form='text')
     def normalize(self, space, form, w_unistr):
         if not space.isinstance_w(w_unistr, space.w_unicode):
             raise oefmt(
diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py
--- a/pypy/module/zipimport/interp_zipimport.py
+++ b/pypy/module/zipimport/interp_zipimport.py
@@ -46,7 +46,7 @@
     # I don't care about speed of those, they're obscure anyway
     # THIS IS A TERRIBLE HACK TO BE CPYTHON COMPATIBLE
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def getitem(self, space, name):
         try:
             w_zipimporter = self.cache[name]
@@ -86,14 +86,14 @@
     def iteritems(self, space):
         return space.iter(self.items(space))
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def contains(self, space, name):
         return space.newbool(name in self.cache)
 
     def clear(self, space):
         self.cache = {}
 
-    @unwrap_spec(name=str)
+    @unwrap_spec(name='text')
     def delitem(self, space, name):
         del self.cache[name]
 
@@ -215,7 +215,7 @@
         except KeyError:
             return False
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def find_module(self, space, fullname, w_path=None):
         filename = self.make_filename(fullname)
         for _, _, ext in ENUMERATE_EXTS:
@@ -240,7 +240,7 @@
         """
         return self.filename + os.path.sep + filename
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def load_module(self, space, fullname):
         filename = self.make_filename(fullname)
         for compiled, is_package, ext in ENUMERATE_EXTS:
@@ -274,7 +274,7 @@
                     raise
         raise oefmt(get_error(space), "can't find module '%s'", fullname)
 
-    @unwrap_spec(filename=str)
+    @unwrap_spec(filename='text')
     def get_data(self, space, filename):
         filename = self._find_relative_path(filename)
         try:
@@ -287,7 +287,7 @@
             # from the zlib module: let's to the same
             raise zlib_error(space, e.msg)
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def get_code(self, space, fullname):
         filename = self.make_filename(fullname)
         for compiled, _, ext in ENUMERATE_EXTS:
@@ -311,7 +311,7 @@
                     "Cannot find source or code for %s in %s",
                     filename, self.name)
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def get_source(self, space, fullname):
         filename = self.make_filename(fullname)
         found = False
@@ -327,7 +327,7 @@
         raise oefmt(get_error(space),
                     "Cannot find source for %s in %s", filename, self.name)
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def get_filename(self, space, fullname):
         filename = self.make_filename(fullname)
         for _, is_package, ext in ENUMERATE_EXTS:
@@ -337,7 +337,7 @@
         raise oefmt(get_error(space),
                     "Cannot find module %s in %s", filename, self.name)
 
-    @unwrap_spec(fullname=str)
+    @unwrap_spec(fullname='text')
     def is_package(self, space, fullname):
         filename = self.make_filename(fullname)
         for _, is_package, ext in ENUMERATE_EXTS:


More information about the pypy-commit mailing list