changeset 81:24752db487c5

Fixed errors in the win32 module
author Oleg Oshmyan <chortos@inbox.lv>
date Wed, 16 Feb 2011 15:30:57 +0000
parents 809b77302b21
children 06356af50bf9
files testcases.py win32.py
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/testcases.py	Wed Feb 16 00:01:33 2011 +0000
+++ b/testcases.py	Wed Feb 16 15:30:57 2011 +0000
@@ -303,7 +303,8 @@
            'TimeLimitExceeded', 'CanceledByUser', 'WrongAnswer',
            'NonZeroExitCode', 'CannotStartTestee',
            'CannotStartValidator', 'CannotReadOutputFile',
-           'CannotReadInputFile', 'CannotReadAnswerFile')
+           'CannotReadInputFile', 'CannotReadAnswerFile',
+           'MemoryLimitExceeded')
 
 
 
--- a/win32.py	Wed Feb 16 00:01:33 2011 +0000
+++ b/win32.py	Wed Feb 16 15:30:57 2011 +0000
@@ -4,6 +4,8 @@
 
 try:
 	from compat import *
+	from testcases import (TimeLimitExceeded, MemoryLimitExceeded,
+	                       CanceledByUser, CannotStartTestee)
 except ImportError:
 	import __main__
 	__main__.import_error(sys.exc_info()[1])
@@ -87,7 +89,7 @@
 			self.handle = handle.Detach()
 		else:
 			raise TypeError("Handle() argument must be a handle, not '%s'" %
-			                type(name).__name__)
+			                type(handle).__name__)
 	
 	def __int__(self):
 		return int(self.handle)
@@ -115,10 +117,10 @@
 	unicode
 except NameError:
 	LPCTSTR = LPCWSTR
-	unisuffix = 'W'
+	UNISUFFIX = 'W'
 else:
 	LPCTSTR = LPCSTR
-	unisuffix = 'A'
+	UNISUFFIX = 'A'
 
 
 prototype = WINFUNCTYPE(BOOL, Handle,
@@ -244,7 +246,7 @@
 prototype = WINFUNCTYPE(HANDLE, c_void_p, LPCTSTR)
 flags = (5, 'attributes'), (1, 'name')
 try:
-	CreateJobObject = prototype(('CreateJobObject'+unisuffix, windll.kernel32),
+	CreateJobObject = prototype(('CreateJobObject'+UNISUFFIX, windll.kernel32),
 	                            flags)
 except AttributeError:
 	# Available on 2000 and up, NT line only
@@ -400,11 +402,11 @@
 
 # Do not show error messages due to errors in the program being tested
 try:
-	errmode = ctypes.windll.kernel32.GetErrorMode()
+	errmode = windll.kernel32.GetErrorMode()
 except AttributeError:
 	# GetErrorMode is available on Vista/2008 and up
-	errmode = ctypes.windll.kernel32.SetErrorMode(0)
-ctypes.windll.kernel32.SetErrorMode(errmode | 0x8003)
+	errmode = windll.kernel32.SetErrorMode(0)
+windll.kernel32.SetErrorMode(errmode | 0x8003)
 
 stdin = GetStdHandle(STD_INPUT_HANDLE)
 try: