@@ -440,8 +440,10 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
440440
441441 switch (PySequence_Length (args )) {
442442 case 3 :
443- /* open() errors give third argument which is the filename. But so
444- * common in-place unpacking doesn't break, e.g.:
443+ /* Where a function has a single filename, such as open() or some
444+ * of the os module functions, PyErr_SetFromErrnoWithFilename() is
445+ * called, giving a third argument which is the filename. But, so
446+ * that old code using in-place unpacking doesn't break, e.g.:
445447 *
446448 * except IOError, (errno, strerror):
447449 *
@@ -465,9 +467,12 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
465467 subslice = PySequence_GetSlice (args , 0 , 2 );
466468 if (!subslice || PyObject_SetAttrString (self , "args" , subslice ))
467469 goto finally ;
470+ break ;
468471
469472 case 2 :
470- /* common case: PyErr_SetFromErrno() */
473+ /* Used when PyErr_SetFromErrno() is called and no filename
474+ * argument is given.
475+ */
471476 item0 = PySequence_GetItem (args , 0 );
472477 item1 = PySequence_GetItem (args , 1 );
473478 if (!item0 || !item1 )
@@ -478,6 +483,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
478483 {
479484 goto finally ;
480485 }
486+ break ;
481487 }
482488
483489 Py_INCREF (Py_None );
0 commit comments