diff Python/errors.c @ 72879:41a1de81ef2b

PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 12 Oct 2011 02:54:14 +0200
parents 81380082d216
children 793c75177d28
line wrap: on
line diff
--- a/Python/errors.c	Wed Oct 12 00:54:35 2011 +0200
+++ b/Python/errors.c	Wed Oct 12 02:54:14 2011 +0200
@@ -496,10 +496,11 @@
         return NULL;
     }
 
-    if (filenameObject != NULL)
-        v = Py_BuildValue("(iOO)", err, message, filenameObject);
-    else
-        v = Py_BuildValue("(iO)", err, message);
+    if (filenameObject == NULL)
+        filenameObject = Py_None;
+    /* This is the constructor signature for passing a Windows error code.
+       The POSIX translation will be figured out by the constructor. */
+    v = Py_BuildValue("(iOOi)", 0, message, filenameObject, err);
     Py_DECREF(message);
 
     if (v != NULL) {