Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: call-loopinvariant-into-bridges
Changeset: r93882:ebe462fa49b9
Date: 2018-02-24 09:27 +0100
http://bitbucket.org/pypy/pypy/changeset/ebe462fa49b9/

Log:    merge default

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -44,3 +44,7 @@
 .. branch: msvc14
 
 Allow compilaiton with Visual Studio 2017 compiler suite on windows
+
+.. branch: refactor-slots
+
+Refactor cpyext slots.
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -137,14 +137,11 @@
     def decorator(f):
         def get_annotation(t):
             from rpython.annotator.signature import annotation
-            from rpython.annotator.model import SomeObject, SomeString, 
SomeUnicodeString
+            from rpython.annotator.model import SomeObject
             if isinstance(t, SomeObject):
                 return t
-            s_result = annotation(t)
-            if (isinstance(s_result, SomeString) or
-                isinstance(s_result, SomeUnicodeString)):
-                return s_result.__class__(can_be_None=True)
-            return s_result
+            return annotation(t)
+
         def get_type_descr_of_argument(arg):
             # we don't want to check *all* the items in list/dict: we assume
             # they are already homogeneous, so we only check the first
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -109,9 +109,9 @@
             wchar_t const* file,
             unsigned int line,
             uintptr_t pReserved) {
-                wprintf(L"Invalid parameter detected in function %s."  
-                            L" File: %s Line: %d\\n", function, file, line);  
-                wprintf(L"Expression: %s\\n", expression);  
+                wprintf(L"Invalid parameter detected in function %s."
+                            L" File: %s Line: %d\\n", function, file, line);
+                wprintf(L"Expression: %s\\n", expression);
         }
 
         RPY_EXTERN void* enter_suppress_iph(void)
@@ -267,7 +267,7 @@
 
 
 if os.name == 'nt':
-    is_valid_fd = jit.dont_look_inside(external("_PyVerify_fd", [rffi.INT], 
+    is_valid_fd = jit.dont_look_inside(external("_PyVerify_fd", [rffi.INT],
         rffi.INT, compilation_info=errno_eci,
         ))
     c_enter_suppress_iph = jit.dont_look_inside(external("enter_suppress_iph",
@@ -515,7 +515,7 @@
                    releasegil=False, save_err=rffi.RFFI_SAVE_ERRNO)
 
 @replace_os_function('read')
-@enforceargs(int, int)
+@signature(types.int(), types.int(), returns=types.any())
 def read(fd, count):
     if count < 0:
         raise OSError(errno.EINVAL, None)
@@ -526,7 +526,7 @@
             return buf.str(got)
 
 @replace_os_function('write')
-@enforceargs(int, None)
+@signature(types.int(), types.any(), returns=types.any())
 def write(fd, data):
     count = len(data)
     with FdValidator(fd):
@@ -536,6 +536,7 @@
             return handle_posix_error('write', ret)
 
 @replace_os_function('close')
+@signature(types.int(), returns=types.any())
 def close(fd):
     with FdValidator(fd):
         handle_posix_error('close', c_close(fd))
diff --git a/rpython/rlib/test/test_objectmodel.py 
b/rpython/rlib/test/test_objectmodel.py
--- a/rpython/rlib/test/test_objectmodel.py
+++ b/rpython/rlib/test/test_objectmodel.py
@@ -484,12 +484,6 @@
     # in RPython there is an implicit int->float promotion
     assert f(42) == 42
 
-def test_enforceargs_None_string():
-    @enforceargs(str, unicode)
-    def f(a, b):
-        return a, b
-    assert f(None, None) == (None, None)
-
 def test_enforceargs_complex_types():
     @enforceargs([int], {str: int})
     def f(a, b):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to