Author: Philip Jenvey <pjen...@underboss.org>
Branch: py3k
Changeset: r87371:0490b8a7a564
Date: 2016-09-25 09:45 -0700
http://bitbucket.org/pypy/pypy/changeset/0490b8a7a564/

Log:    reapply 995f8366f830 to cffi: accept py3 strs via CreateProcessW

diff --git a/lib_pypy/_pypy_winbase_build.py b/lib_pypy/_pypy_winbase_build.py
--- a/lib_pypy/_pypy_winbase_build.py
+++ b/lib_pypy/_pypy_winbase_build.py
@@ -76,9 +76,9 @@
 HANDLE WINAPI GetCurrentProcess(void);
 BOOL WINAPI DuplicateHandle(HANDLE, HANDLE, HANDLE, LPHANDLE,
                             DWORD, BOOL, DWORD);
-BOOL WINAPI CreateProcessA(char *, char *, void *,
-                           void *, BOOL, DWORD, char *,
-                           char *, LPSTARTUPINFO, LPPROCESS_INFORMATION);
+BOOL WINAPI CreateProcessW(wchar_t *, wchar_t *, void *,
+                           void *, BOOL, DWORD, wchar_t *,
+                           wchar_t *, LPSTARTUPINFO, LPPROCESS_INFORMATION);
 DWORD WINAPI WaitForSingleObject(HANDLE, DWORD);
 BOOL WINAPI GetExitCodeProcess(HANDLE, LPDWORD);
 BOOL WINAPI TerminateProcess(HANDLE, UINT);
diff --git a/lib_pypy/_winapi.py b/lib_pypy/_winapi.py
--- a/lib_pypy/_winapi.py
+++ b/lib_pypy/_winapi.py
@@ -58,12 +58,12 @@
 
     return _handle2int(target[0])
 
-def _z(input):
+def _Z(input):
     if input is None:
         return _ffi.NULL
-    if isinstance(input, basestring):
-        return str(input)
-    raise TypeError("string/unicode/None expected, got %r" % (
+    if isinstance(input, str):
+        return input
+    raise TypeError("str or None expected, got %r" % (
         type(input).__name__,))
 
 def CreateProcess(name, command_line, process_attr, thread_attr,
@@ -92,9 +92,9 @@
     else:
         envbuf = _ffi.NULL
 
-    res = _kernel32.CreateProcessA(_z(name), _z(command_line), _ffi.NULL,
+    res = _kernel32.CreateProcessW(_Z(name), _Z(command_line), _ffi.NULL,
                                    _ffi.NULL, inherit, flags, envbuf,
-                                   _z(start_dir), si, pi)
+                                   _Z(start_dir), si, pi)
 
     if not res:
         raise _WinError()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to