Author: Ronny Pfannschmidt <[email protected]>
Branch: pytest
Changeset: r52577:97e8ddb2e756
Date: 2012-02-17 12:07 +0100
http://bitbucket.org/pypy/pypy/changeset/97e8ddb2e756/
Log: sync pylib with 1.7.4 + mattip's patch
diff --git a/py/__init__.py b/py/__init__.py
--- a/py/__init__.py
+++ b/py/__init__.py
@@ -8,7 +8,7 @@
(c) Holger Krekel and others, 2004-2010
"""
-__version__ = '1.4.7.dev3'
+__version__ = '1.4.7'
from py import _apipkg
diff --git a/py/_io/terminalwriter.py b/py/_io/terminalwriter.py
--- a/py/_io/terminalwriter.py
+++ b/py/_io/terminalwriter.py
@@ -194,10 +194,17 @@
if not self._newline:
self.write("\r")
self.write(line, **opts)
- lastlen = getattr(self, '_lastlinelen', None)
- self._lastlinelen = lenlastline = len(line)
- if lenlastline < lastlen:
- self.write(" " * (lastlen - lenlastline + 1))
+ # see if we need to fill up some spaces at the end
+ # xxx have a more exact lastlinelen working from self.write?
+ lenline = len(line)
+ try:
+ lastlen = self._lastlinelen
+ except AttributeError:
+ pass
+ else:
+ if lenline < lastlen:
+ self.write(" " * (lastlen - lenline + 1))
+ self._lastlinelen = lenline
self._newline = False
@@ -287,16 +294,24 @@
('srWindow', SMALL_RECT),
('dwMaximumWindowSize', COORD)]
+ _GetStdHandle = ctypes.windll.kernel32.GetStdHandle
+ _GetStdHandle.argtypes = [wintypes.DWORD]
+ _GetStdHandle.restype = wintypes.HANDLE
def GetStdHandle(kind):
- return ctypes.windll.kernel32.GetStdHandle(kind)
+ return _GetStdHandle(kind)
- SetConsoleTextAttribute = \
- ctypes.windll.kernel32.SetConsoleTextAttribute
+ SetConsoleTextAttribute = ctypes.windll.kernel32.SetConsoleTextAttribute
+ SetConsoleTextAttribute.argtypes = [wintypes.HANDLE, wintypes.WORD]
+ SetConsoleTextAttribute.restype = wintypes.BOOL
+ _GetConsoleScreenBufferInfo = \
+ ctypes.windll.kernel32.GetConsoleScreenBufferInfo
+ _GetConsoleScreenBufferInfo.argtypes = [wintypes.HANDLE,
+ ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO)]
+ _GetConsoleScreenBufferInfo.restype = wintypes.BOOL
def GetConsoleInfo(handle):
info = CONSOLE_SCREEN_BUFFER_INFO()
- ctypes.windll.kernel32.GetConsoleScreenBufferInfo(\
- handle, ctypes.byref(info))
+ _GetConsoleScreenBufferInfo(handle, ctypes.byref(info))
return info
def _getdimensions():
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit