Commits

Lenard Lindstrom committed 893b7dd

fix bug introduced into the test framework in r2938

Comments (0)

Files changed (1)

test/test_utils/async_sub.py

 def geterror ():
     return sys.exc_info()[1]
 
+if sys.version_info >= (3,):
+    null_byte = '\x00'.encode('ascii')
+else:
+    null_byte = '\x00'
+
 if subprocess.mswindows:
     if sys.version_info >= (3,):
         # Test date should be in ascii.
             c_read = DWORD()
             buffer = ctypes.create_string_buffer(desired_bytes+1)
             success = ctypes.windll.kernel32.ReadFile(handle, buffer, desired_bytes, ctypes.byref(c_read), ol)
-            buffer[c_read.value] = ctypes.c_char(0)
+            buffer[c_read.value] = null_byte
             return ctypes.windll.kernel32.GetLastError(), decode(buffer.value)
         def PeekNamedPipe(handle, desired_bytes):
             c_avail = DWORD()
                 c_read = DWORD()
                 buffer = ctypes.create_string_buffer(desired_bytes+1)
                 success = ctypes.windll.kernel32.PeekNamedPipe(handle, buffer, desired_bytes, ctypes.byref(c_read), ctypes.byref(c_avail), ctypes.byref(c_message))
-                buffer[c_read.value] = ctypes.c_char(0)
+                buffer[c_read.value] = null_byte
                 return decode(buffer.value), c_avail.value, c_message.value
             else:
                 success = ctypes.windll.kernel32.PeekNamedPipe(handle, None, desired_bytes, None, ctypes.byref(c_avail), ctypes.byref(c_message))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.