Author: Matti Picus <matti.pi...@gmail.com>
Branch: py3.5
Changeset: r95197:fadba769e9bf
Date: 2018-10-09 17:36 +0300
http://bitbucket.org/pypy/pypy/changeset/fadba769e9bf/

Log:    merge default into branch

diff --git a/pypy/module/_cffi_backend/embedding.py 
b/pypy/module/_cffi_backend/embedding.py
--- a/pypy/module/_cffi_backend/embedding.py
+++ b/pypy/module/_cffi_backend/embedding.py
@@ -95,7 +95,9 @@
 if os.name == 'nt':
 
     do_includes = r"""
+#ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501
+#endif
 #include <windows.h>
 
 static void _cffi_init(void);
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
@@ -1557,6 +1557,9 @@
         }
         '''
         separate_module_sources.append(get_pythonapi_source)
+        kwds['post_include_bits'] = [
+                            'RPY_EXTERN HANDLE pypy_get_pythonapi_handle();',
+                                    ]
 
     eci = ExternalCompilationInfo(
         include_dirs=include_dirs,
diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -231,7 +231,9 @@
 if os.name == 'nt':
 
     _source_code = r"""
+#ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501
+#endif
 #include <windows.h>
 #include <stdio.h>
 
diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py
--- a/rpython/rlib/rmmap.py
+++ b/rpython/rlib/rmmap.py
@@ -835,7 +835,7 @@
         # assume -1 and 0 both mean invalid file descriptor
         # to 'anonymously' map memory.
         if fileno != -1 and fileno != 0:
-            fh = rwin32.get_osfhandle(fileno)
+            fh = rffi.cast(HANDLE, rwin32.get_osfhandle(fileno))
             # Win9x appears to need us seeked to zero
             # SEEK_SET = 0
             # libc._lseek(fileno, 0, SEEK_SET)
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -137,7 +137,10 @@
         RPY_EXTERN void exit_suppress_iph(void* handle) {};
         #endif
     ''',]
-    post_include_bits=['RPY_EXTERN int _PyVerify_fd(int);']
+    post_include_bits=['RPY_EXTERN int _PyVerify_fd(int);',
+                       'RPY_EXTERN void* enter_suppress_iph();',
+                       'RPY_EXTERN void exit_suppress_iph(void* handle);',
+                      ]
 else:
     separate_module_sources = []
     post_include_bits = []
@@ -235,7 +238,8 @@
             rthread.tlfield_rpy_errno.setraw(_get_errno())
             # ^^^ keep fork() up-to-date too, below
 if _WIN32:
-    includes = ['io.h', 'sys/utime.h', 'sys/types.h', 'process.h', 'time.h']
+    includes = ['io.h', 'sys/utime.h', 'sys/types.h', 'process.h', 'time.h',
+                'direct.h']
     libraries = []
 else:
     if sys.platform.startswith(('darwin', 'netbsd', 'openbsd')):
diff --git a/rpython/rlib/rwin32.py b/rpython/rlib/rwin32.py
--- a/rpython/rlib/rwin32.py
+++ b/rpython/rlib/rwin32.py
@@ -20,7 +20,7 @@
 
 if WIN32:
     eci = ExternalCompilationInfo(
-        includes = ['windows.h', 'stdio.h', 'stdlib.h'],
+        includes = ['windows.h', 'stdio.h', 'stdlib.h', 'io.h'],
         libraries = ['kernel32'],
         )
 else:
@@ -197,9 +197,9 @@
     LoadLibrary = winexternal('LoadLibraryA', [rffi.CCHARP], HMODULE,
                               save_err=rffi.RFFI_SAVE_LASTERROR)
     def wrap_loadlibraryex(func):
-        def loadlibrary(name, handle=None, 
flags=LOAD_WITH_ALTERED_SEARCH_PATH):
+        def loadlibrary(name, flags=LOAD_WITH_ALTERED_SEARCH_PATH):
             # Requires a full path name with '/' -> '\\'
-            return func(name, handle, flags)
+            return func(name, NULL_HANDLE, flags)
         return loadlibrary
 
     _LoadLibraryExA = winexternal('LoadLibraryExA',
@@ -217,7 +217,7 @@
                                  rffi.VOIDP)
     FreeLibrary = winexternal('FreeLibrary', [HMODULE], BOOL, releasegil=False)
 
-    LocalFree = winexternal('LocalFree', [HLOCAL], DWORD)
+    LocalFree = winexternal('LocalFree', [HLOCAL], HLOCAL)
     CloseHandle = winexternal('CloseHandle', [HANDLE], BOOL, releasegil=False,
                               save_err=rffi.RFFI_SAVE_LASTERROR)
     CloseHandle_no_err = winexternal('CloseHandle', [HANDLE], BOOL,
@@ -232,12 +232,12 @@
         [DWORD, rffi.VOIDP, DWORD, DWORD, rffi.CWCHARP, DWORD, rffi.VOIDP],
         DWORD)
 
-    _get_osfhandle = rffi.llexternal('_get_osfhandle', [rffi.INT], HANDLE)
+    _get_osfhandle = rffi.llexternal('_get_osfhandle', [rffi.INT], rffi.INTP)
 
     def get_osfhandle(fd):
         from rpython.rlib.rposix import FdValidator
         with FdValidator(fd):
-            handle = _get_osfhandle(fd)
+            handle = rffi.cast(HANDLE, _get_osfhandle(fd))
         if handle == INVALID_HANDLE_VALUE:
             raise WindowsError(ERROR_INVALID_HANDLE, "Invalid file handle")
         return handle
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to