Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r73683:2e736033bd2b Date: 2014-09-24 19:14 -0700 http://bitbucket.org/pypy/pypy/changeset/2e736033bd2b/
Log: we really want a unicodebuffer here diff --git a/rpython/rtyper/module/ll_win32file.py b/rpython/rtyper/module/ll_win32file.py --- a/rpython/rtyper/module/ll_win32file.py +++ b/rpython/rtyper/module/ll_win32file.py @@ -476,24 +476,24 @@ VOLUME_NAME_DOS = rffi.cast(rwin32.DWORD, win32traits.VOLUME_NAME_DOS) try: - size = win32traits.GetFinalPathNameByHandle( + usize = win32traits.GetFinalPathNameByHandle( hFile, lltype.nullptr(traits.CCHARP.TO), rffi.cast(rwin32.DWORD, 0), VOLUME_NAME_DOS) - if size == 0: + if usize == 0: raise rwin32.lastWindowsError("GetFinalPathNameByHandle") - with lltype.scoped_alloc(traits.CCHARP.TO, size + 1) as target_path: + size = rffi.cast(lltype.Signed, usize) + with rffi.scoped_alloc_unicodebuffer(size + 1) as buf: result = win32traits.GetFinalPathNameByHandle( hFile, - target_path, - size, + buf.raw, + usize, VOLUME_NAME_DOS) if result == 0: raise rwin32.lastWindowsError("GetFinalPathNameByHandle") - return traits.charpsize2str(target_path, - rffi.cast(lltype.Signed, result)) + return buf.str(rffi.cast(lltype.Signed, result)) finally: rwin32.CloseHandle(hFile) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit