python ctypes bug - 0x%08X
Update
This bug has been fixed. Verified in ctypes 0.9.6.
Problem
ctypes sends this formatting string for some Windows errors:
"exception code 0x%08X"
Only c,d,x,s,p are documented formatting characters for PyErr_Format.
"An unrecognized format character causes all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded."
Solution
The patch is a one character change in callproc.c:
--- callproc_old.c	Thu Oct 28 20:01:58 2004
+++ callproc.c	Wed Feb 02 11:41:24 2005
@@ -242,7 +242,7 @@
 		default:
 			printf("error %d\n", code);
 			PyErr_Format(PyExc_WindowsError,
-				     "exception code 0x%08X",
+				     "exception code 0x%08x",
 				     code);
 			break;
 		}
See: callprocpatch.txt
Extra
• This bug has existed for at least a year, since 0.6.3.
This patch was created for 0.9.2, the current latest version.
• I have verified this is fixed in ctypes 0.9.6.