Author: Richard Plangger <planri...@gmail.com> Branch: ppc-vsx-support Changeset: r87342:efea0d994471 Date: 2016-09-23 10:06 +0200 http://bitbucket.org/pypy/pypy/changeset/efea0d994471/
Log: merge default diff --git a/lib_pypy/_subprocess.py b/lib_pypy/_subprocess.py --- a/lib_pypy/_subprocess.py +++ b/lib_pypy/_subprocess.py @@ -22,7 +22,10 @@ code, message = _ffi.getwinerror() raise WindowsError(code, message) -_INVALID_HANDLE_VALUE = _ffi.cast("HANDLE", -1) +def _int2handle(val): + return _ffi.cast("HANDLE", val) + +_INVALID_HANDLE_VALUE = _int2handle(-1) class _handle(object): def __init__(self, c_handle): @@ -70,9 +73,9 @@ target = _ffi.new("HANDLE[1]") res = _kernel32.DuplicateHandle( - _ffi.cast("HANDLE", source_process), - _ffi.cast("HANDLE", source), - _ffi.cast("HANDLE", target_process), + _int2handle(source_process), + _int2handle(source), + _int2handle(target_process), target, access, inherit, options) if not res: @@ -119,12 +122,14 @@ if not res: raise _WinError() - return _handle(pi.hProcess), _handle(pi.hThread), pi.dwProcessId, pi.dwThreadId + return (_handle(pi.hProcess), + _handle(pi.hThread), + pi.dwProcessId, + pi.dwThreadId) def WaitForSingleObject(handle, milliseconds): # CPython: the first argument is expected to be an integer. - res = _kernel32.WaitForSingleObject(_ffi.cast("HANDLE", handle), - milliseconds) + res = _kernel32.WaitForSingleObject(_int2handle(handle), milliseconds) if res < 0: raise _WinError() @@ -134,7 +139,7 @@ # CPython: the first argument is expected to be an integer. code = _ffi.new("DWORD[1]") - res = _kernel32.GetExitCodeProcess(_ffi.cast("HANDLE", handle), code) + res = _kernel32.GetExitCodeProcess(_int2handle(handle), code) if not res: raise _WinError() @@ -144,7 +149,7 @@ def TerminateProcess(handle, exitcode): # CPython: the first argument is expected to be an integer. # The second argument is silently wrapped in a UINT. - res = _kernel32.TerminateProcess(_ffi.cast("HANDLE", handle), + res = _kernel32.TerminateProcess(_int2handle(handle), _ffi.cast("UINT", exitcode)) if not res: diff --git a/rpython/rlib/rposix_stat.py b/rpython/rlib/rposix_stat.py --- a/rpython/rlib/rposix_stat.py +++ b/rpython/rlib/rposix_stat.py @@ -147,13 +147,20 @@ # (we ignore the extra values here for simplicity and portability) def stat_result_reduce(st): return (st[0], st[1], st[2], st[3], st[4], - st[5], st[6], st[7], st[8], st[9], - st[-3], st[-2], st[-1]) + st[5], st[6], st.st_atime, st.st_mtime, st.st_ctime) def stat_result_recreate(tup): - return make_stat_result(tup[:10] + extra_zeroes + tup[-3:]) + atime, mtime, ctime = tup[7:] + result = tup[:7] + result += (int(atime), int(mtime), int(ctime)) + result += extra_zeroes + result += (int((atime - result[7]) * 1e9), + int((mtime - result[8]) * 1e9), + int((ctime - result[9]) * 1e9)) + return make_stat_result(result) s_reduced = annmodel.SomeTuple([lltype_to_annotation(TYPE) - for name, TYPE in PORTABLE_STAT_FIELDS]) + for name, TYPE in PORTABLE_STAT_FIELDS[:7]] + + 3 * [lltype_to_annotation(lltype.Float)]) extra_zeroes = (0,) * (len(STAT_FIELDS) - len(PORTABLE_STAT_FIELDS) - 3) return s_reduced, stat_result_reduce, stat_result_recreate _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit