summaryrefslogtreecommitdiffstats
path: root/PC/generrmap.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-05-11 13:28:43 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-05-11 13:28:43 (GMT)
commit879768dd97f98626c919a460a90dd0d54855de9c (patch)
tree8813f6d751a0087d8402860bc82e54ca87f0028c /PC/generrmap.c
parent38e3b7d2d36a2029ad86c9c23d031e5350e80d35 (diff)
downloadcpython-879768dd97f98626c919a460a90dd0d54855de9c.zip
cpython-879768dd97f98626c919a460a90dd0d54855de9c.tar.gz
cpython-879768dd97f98626c919a460a90dd0d54855de9c.tar.bz2
Change WindowsError to carry the Win32 error code in winerror,
and the DOS error code in errno. Revert changes where WindowsError catch blocks unnecessarily special-case OSError.
Diffstat (limited to 'PC/generrmap.c')
-rw-r--r--PC/generrmap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/PC/generrmap.c b/PC/generrmap.c
new file mode 100644
index 0000000..2b25063
--- /dev/null
+++ b/PC/generrmap.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <errno.h>
+
+/* Extract the mapping of Win32 error codes to errno */
+
+int main()
+{
+ int i;
+ printf("/* Generated file. Do not edit. */\n");
+ printf("int winerror_to_errno(int winerror)\n");
+ printf("{\n\tswitch(winerror) {\n");
+ for(i=1; i < 65000; i++) {
+ _dosmaperr(i);
+ if (errno == EINVAL)
+ continue;
+ printf("\t\tcase %d: return %d;\n", i, errno);
+ }
+ printf("\t\tdefault: return EINVAL;\n");
+ printf("\t}\n}\n");
+}