[pypy-commit] pypy default: Use @signature to prevent late-stage annotation issues

rlamy pypy.commits at gmail.com
Fri Feb 23 09:21:15 EST 2018


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r93875:b6c556e371ec
Date: 2018-02-23 14:20 +0000
http://bitbucket.org/pypy/pypy/changeset/b6c556e371ec/

Log:	Use @signature to prevent late-stage annotation issues

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')
- at enforceargs(int, int)
+ at 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')
- at enforceargs(int, None)
+ at 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')
+ at signature(types.int(), returns=types.any())
 def close(fd):
     with FdValidator(fd):
         handle_posix_error('close', c_close(fd))


More information about the pypy-commit mailing list