aboutsummaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2012-02-17 12:07:28 +0100
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2012-02-17 12:07:28 +0100
commitfc84a8907353278264874575cc87afe265b958a8 (patch)
tree3abbd32f52bfa57ba285fadfc427d4d35021aaf0 /py
parentfix the remaining testrunner issues (diff)
downloadpypy-fc84a8907353278264874575cc87afe265b958a8.tar.gz
pypy-fc84a8907353278264874575cc87afe265b958a8.tar.bz2
pypy-fc84a8907353278264874575cc87afe265b958a8.zip
sync pylib with 1.7.4 + mattip's patch
Diffstat (limited to 'py')
-rw-r--r--py/__init__.py2
-rw-r--r--py/_io/terminalwriter.py33
2 files changed, 25 insertions, 10 deletions
diff --git a/py/__init__.py b/py/__init__.py
index e4f243e2e6..bf6c2128fa 100644
--- a/py/__init__.py
+++ b/py/__init__.py
@@ -8,7 +8,7 @@ dictionary or an import path.
(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
index fa9e9f9cfc..a1d92bc003 100644
--- a/py/_io/terminalwriter.py
+++ b/py/_io/terminalwriter.py
@@ -194,10 +194,17 @@ class TerminalWriter(object):
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 @@ if win32_and_ctypes:
('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():