Oops, really pass a bytes string to the ctypes function.
diff --git a/Tools/unicode/genwincodec.py b/Tools/unicode/genwincodec.py
index 17ba809..9134622 100644
--- a/Tools/unicode/genwincodec.py
+++ b/Tools/unicode/genwincodec.py
@@ -24,7 +24,7 @@
         buf = ctypes.create_unicode_buffer(2)

         ret = MultiByteToWideChar(

             codepage, 0,

-            chr(i), 1,

+            bytes([i]), 1,

             buf, 2)

         assert ret == 1, "invalid code page"

         assert buf[1] == '\x00'