Kaydet (Commit) d5baeee6 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #8966: Fix ctypes tests for Windows

I removed the implicit conversion from str to bytes.
üst 73a01d4f
...@@ -45,7 +45,6 @@ class BytesTest(unittest.TestCase): ...@@ -45,7 +45,6 @@ class BytesTest(unittest.TestCase):
_type_ = "X" _type_ = "X"
BSTR("abc") BSTR("abc")
BSTR(b"abc")
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -97,7 +97,7 @@ class LoaderTest(unittest.TestCase): ...@@ -97,7 +97,7 @@ class LoaderTest(unittest.TestCase):
self.assertEqual(0, advapi32.CloseEventLog(None)) self.assertEqual(0, advapi32.CloseEventLog(None))
windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p
windll.kernel32.GetProcAddress.restype = c_void_p windll.kernel32.GetProcAddress.restype = c_void_p
proc = windll.kernel32.GetProcAddress(advapi32._handle, "CloseEventLog") proc = windll.kernel32.GetProcAddress(advapi32._handle, b"CloseEventLog")
self.assertTrue(proc) self.assertTrue(proc)
# This is the real test: call the function via 'call_function' # This is the real test: call the function via 'call_function'
self.assertEqual(0, call_function(proc, (None,))) self.assertEqual(0, call_function(proc, (None,)))
......
...@@ -18,7 +18,7 @@ if sys.platform == "win32": ...@@ -18,7 +18,7 @@ if sys.platform == "win32":
windll.kernel32.GetProcAddress.restype = c_void_p windll.kernel32.GetProcAddress.restype = c_void_p
hdll = windll.kernel32.LoadLibraryA(b"kernel32") hdll = windll.kernel32.LoadLibraryA(b"kernel32")
funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA") funcaddr = windll.kernel32.GetProcAddress(hdll, b"GetModuleHandleA")
self.assertEqual(call_function(funcaddr, (None,)), self.assertEqual(call_function(funcaddr, (None,)),
windll.kernel32.GetModuleHandleA(None)) windll.kernel32.GetModuleHandleA(None))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment