Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r90294:7639500dbd0e
Date: 2017-02-22 14:14 +0100
http://bitbucket.org/pypy/pypy/changeset/7639500dbd0e/

Log:    hg merge default

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1584,7 +1584,7 @@
     def text_or_None_w(self, w_obj):
         return None if self.is_none(w_obj) else self.text_w(w_obj)
 
-    #@not_rpython    BACKCOMPAT: should be replaced with bytes_w or text_w
+    @not_rpython    # tests only; should be replaced with bytes_w or text_w
     def str_w(self, w_obj):
         """
         if w_obj is unicode, call text_w() (i.e., return the UTF-8-nosg
@@ -1602,7 +1602,7 @@
     def bytes_w(self, w_obj):
         return w_obj.bytes_w(self)
 
-    #@not_rpython    BACKCOMPAT
+    @not_rpython    # tests only; should be replaced with bytes0_w or text0_w
     def str0_w(self, w_obj):
         "Like str_w, but rejects strings with NUL bytes."
         from rpython.rlib import rstring
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -162,9 +162,6 @@
     def visit_text_or_None(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
-    def visit_str0(self, el, app_sig):
-        self.checked_space_method(el, app_sig)
-
     def visit_bytes(self, el, app_sig):
         self.checked_space_method(el, app_sig)
 
@@ -314,9 +311,6 @@
     def visit_text_or_None(self, typ):
         self.run_args.append("space.text_or_None_w(%s)" % (self.scopenext(),))
 
-    def visit_str0(self, typ):
-        self.run_args.append("space.str0_w(%s)" % (self.scopenext(),))
-
     def visit_bytes(self, typ):
         self.run_args.append("space.bytes_w(%s)" % (self.scopenext(),))
 
@@ -485,9 +479,6 @@
     def visit_text_or_None(self, typ):
         self.unwrap.append("space.text_or_None_w(%s)" % (self.nextarg(),))
 
-    def visit_str0(self, typ):
-        self.unwrap.append("space.str0_w(%s)" % (self.nextarg(),))
-
     def visit_bytes(self, typ):
         self.unwrap.append("space.bytes_w(%s)" % (self.nextarg(),))
 
@@ -648,6 +639,8 @@
                              "the name of an argument of the following "
                              "function" % (name,))
 
+    assert str not in unwrap_spec   # use 'text' or 'bytes' instead of str
+
     return unwrap_spec
 
 
diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -49,7 +49,7 @@
             space.call_method(self.w_dict, 'update', self.w_initialdict)
 
         for w_submodule in self.submodules_w:
-            name = space.str0_w(w_submodule.w_name)
+            name = space.text0_w(w_submodule.w_name)
             space.setitem(self.w_dict, space.newtext(name.split(".")[-1]), 
w_submodule)
             space.getbuiltinmodule(name)
 
diff --git a/pypy/interpreter/module.py b/pypy/interpreter/module.py
--- a/pypy/interpreter/module.py
+++ b/pypy/interpreter/module.py
@@ -37,7 +37,7 @@
 
     def install(self):
         """NOT_RPYTHON: installs this module into space.builtin_modules"""
-        modulename = self.space.str0_w(self.w_name)
+        modulename = self.space.text0_w(self.w_name)
         self.space.builtin_modules[modulename] = self
 
     def setup_after_space_initialization(self):
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,
-                                                      str, 'str_or_None'])
+                                                      'text', 'str_or_None'])
         w_app_g3_ss = space.wrap(app_g3_ss)
         assert self.space.eq_w(
             space.call(w_app_g3_ss,
@@ -530,7 +530,7 @@
 
         app_g3_s = gateway.interp2app_temp(g3_id,
                                          unwrap_spec=[gateway.ObjSpace,
-                                                      str])
+                                                      'text'])
         w_app_g3_s = space.wrap(app_g3_s)
         assert space.eq_w(space.call_function(w_app_g3_s,w("foo")),w("foo"))
         raises(gateway.OperationError,space.call_function,w_app_g3_s,w(None))
diff --git a/pypy/module/__pypy__/interp_os.py 
b/pypy/module/__pypy__/interp_os.py
--- a/pypy/module/__pypy__/interp_os.py
+++ b/pypy/module/__pypy__/interp_os.py
@@ -3,7 +3,7 @@
 from pypy.interpreter.gateway import unwrap_spec
 
 
-@unwrap_spec(name='str0')
+@unwrap_spec(name='text0')
 def real_getenv(space, name):
     """Get an OS environment value skipping Python cache"""
     return space.newtext_or_none(os.environ.get(name))
diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py 
b/pypy/module/_cffi_backend/test/test_recompiler.py
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -6,7 +6,7 @@
 import pypy.module.cpyext.api     # side-effect of pre-importing it
 
 
-@unwrap_spec(cdef=str, module_name=str, source=str, packed=int)
+@unwrap_spec(cdef='text', module_name='text', source='text', packed=int)
 def prepare(space, cdef, module_name, source, w_includes=None,
             w_extra_source=None, w_min_version=None, packed=False):
     try:
diff --git a/pypy/module/_multiprocessing/interp_win32.py 
b/pypy/module/_multiprocessing/interp_win32.py
--- a/pypy/module/_multiprocessing/interp_win32.py
+++ b/pypy/module/_multiprocessing/interp_win32.py
@@ -114,7 +114,7 @@
 # __________________________________________________________
 # functions for the "win32" namespace
 
-@unwrap_spec(name=str, openmode=r_uint, pipemode=r_uint, maxinstances=r_uint,
+@unwrap_spec(name='text', openmode=r_uint, pipemode=r_uint, 
maxinstances=r_uint,
              outputsize=r_uint, inputsize=r_uint, timeout=r_uint)
 def CreateNamedPipe(space, name, openmode, pipemode, maxinstances,
                     outputsize, inputsize, timeout, w_security):
@@ -161,13 +161,13 @@
         lltype.free(state, flavor='raw')
         lltype.free(statep, flavor='raw')
 
-@unwrap_spec(name=str, timeout=r_uint)
+@unwrap_spec(name='text', timeout=r_uint)
 def WaitNamedPipe(space, name, timeout):
     # Careful: zero means "default value specified by CreateNamedPipe()"
     if not _WaitNamedPipe(name, timeout):
         raise wrap_windowserror(space, rwin32.lastSavedWindowsError())
 
-@unwrap_spec(filename=str, access=r_uint, share=r_uint,
+@unwrap_spec(filename='fsencode', access=r_uint, share=r_uint,
              disposition=r_uint, flags=r_uint)
 def CreateFile(space, filename, access, share, w_security,
                disposition, flags, w_templatefile):
diff --git a/pypy/module/_rawffi/alt/test/test_struct.py 
b/pypy/module/_rawffi/alt/test/test_struct.py
--- a/pypy/module/_rawffi/alt/test/test_struct.py
+++ b/pypy/module/_rawffi/alt/test/test_struct.py
@@ -57,7 +57,7 @@
         if cls.runappdirect:
             cls.w_read_raw_mem = cls.read_raw_mem
         else:
-            @unwrap_spec(addr=int, typename=str, length=int)
+            @unwrap_spec(addr=int, typename='text', length=int)
             def read_raw_mem_w(space, addr, typename, length):
                 return space.wrap(cls.read_raw_mem(addr, typename, length))
             cls.w_read_raw_mem = cls.space.wrap(interp2app(read_raw_mem_w))
diff --git a/pypy/module/bz2/test/test_bz2_file.py 
b/pypy/module/bz2/test/test_bz2_file.py
--- a/pypy/module/bz2/test/test_bz2_file.py
+++ b/pypy/module/bz2/test/test_bz2_file.py
@@ -76,7 +76,7 @@
             cls.w_create_temp_file = cls.space.wrap(
                 gateway.interp2app(create_temp_file_w))
 
-            @gateway.unwrap_spec(data=bytes)
+            @gateway.unwrap_spec(data='bytes')
             def decompress_w(space, data):
                 return space.newbytes(decompress(cls, data))
             cls.w_decompress = cls.space.wrap(gateway.interp2app(decompress_w))
diff --git a/pypy/module/cppyy/test/test_crossing.py 
b/pypy/module/cppyy/test/test_crossing.py
--- a/pypy/module/cppyy/test/test_crossing.py
+++ b/pypy/module/cppyy/test/test_crossing.py
@@ -78,7 +78,7 @@
             import ctypes, cppyy""")    # prevents leak-checking complaints on 
ctypes' statics
 
     def setup_method(self, func):
-        @unwrap_spec(name=str, init=str, body=str)
+        @unwrap_spec(name='text', init='text', body='text')
         def create_cdll(space, name, init, body):
             # the following is loosely from test_cpyext.py import_module; it
             # is copied here to be able to tweak the call to
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
@@ -289,7 +289,7 @@
         if self.runappdirect:
             return
 
-        @unwrap_spec(name=str)
+        @unwrap_spec(name='text')
         def compile_module(space, name,
                            w_source_files=None,
                            w_source_strings=None):
@@ -315,7 +315,7 @@
 
             return space.wrap(pydname)
 
-        @unwrap_spec(name=str, init='str_or_None', body=str,
+        @unwrap_spec(name='text', init='str_or_None', body='text',
                      filename='str_or_None', PY_SSIZE_T_CLEAN=bool)
         def import_module(space, name, init=None, body='',
                           filename=None, w_include_dirs=None,
@@ -327,12 +327,12 @@
             return w_result
 
 
-        @unwrap_spec(mod=str, name=str)
+        @unwrap_spec(mod='text', name='text')
         def load_module(space, mod, name):
             return self.sys_info.load_module(mod, name)
 
-        @unwrap_spec(modname=str, prologue=str,
-                             more_init=str, PY_SSIZE_T_CLEAN=bool)
+        @unwrap_spec(modname='text', prologue='text',
+                             more_init='text', PY_SSIZE_T_CLEAN=bool)
         def import_extension(space, modname, w_functions, prologue="",
                              w_include_dirs=None, more_init="", 
PY_SSIZE_T_CLEAN=False):
             functions = space.unwrap(w_functions)
diff --git a/pypy/module/gc/interp_gc.py b/pypy/module/gc/interp_gc.py
--- a/pypy/module/gc/interp_gc.py
+++ b/pypy/module/gc/interp_gc.py
@@ -79,7 +79,7 @@
 
 # ____________________________________________________________
 
-@unwrap_spec(filename='str0')
+@unwrap_spec(filename='fsencode')
 def dump_heap_stats(space, filename):
     tb = rgc._heap_stats()
     if not tb:
diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py
--- a/pypy/module/imp/interp_imp.py
+++ b/pypy/module/imp/interp_imp.py
@@ -56,7 +56,7 @@
 
 def create_builtin(space, w_spec):
     w_name = space.getattr(w_spec, space.newtext("name"))
-    name = space.str0_w(w_name)
+    name = space.text0_w(w_name)
     # force_init is needed to make reload actually reload instead of just
     # using the already-present module in sys.modules.
 
diff --git a/pypy/module/test_lib_pypy/test_md5_extra.py 
b/pypy/module/test_lib_pypy/test_md5_extra.py
--- a/pypy/module/test_lib_pypy/test_md5_extra.py
+++ b/pypy/module/test_lib_pypy/test_md5_extra.py
@@ -101,7 +101,7 @@
             import py
             py.test.skip('Unavailable under py3 runappdirect')
         else:
-            compare_host.unwrap_spec = [str, str, str]
+            compare_host.unwrap_spec = ['bytes', 'bytes', 'text']
             cls.w_compare_host = space.wrap(gateway.interp2app(compare_host))
 
     def w_compare(self, message):
diff --git a/pypy/objspace/std/test/test_mapdict.py 
b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -910,7 +910,7 @@
                 successes = entry.success_counter
             globalfailures = INVALID_CACHE_ENTRY.failure_counter
             return space.wrap((failures, successes, globalfailures))
-        check.unwrap_spec = [gateway.ObjSpace, gateway.W_Root, str]
+        check.unwrap_spec = [gateway.ObjSpace, gateway.W_Root, 'text']
         cls.w_check = cls.space.wrap(gateway.interp2app(check))
 
     def test_simple(self):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to