@@ -1935,7 +1935,9 @@ PyObject *PyExc_AssertionError;
19351935PyObject * PyExc_AttributeError ;
19361936PyObject * PyExc_EOFError ;
19371937PyObject * PyExc_FloatingPointError ;
1938+ PyObject * PyExc_EnvironmentError ;
19381939PyObject * PyExc_IOError ;
1940+ PyObject * PyExc_OSError ;
19391941PyObject * PyExc_ImportError ;
19401942PyObject * PyExc_IndexError ;
19411943PyObject * PyExc_KeyError ;
@@ -1968,7 +1970,9 @@ bltin_exc[] = {
19681970 {"AttributeError" , & PyExc_AttributeError , 1 },
19691971 {"EOFError" , & PyExc_EOFError , 1 },
19701972 {"FloatingPointError" , & PyExc_FloatingPointError , 1 },
1973+ {"EnvironmentError" , & PyExc_EnvironmentError , 1 },
19711974 {"IOError" , & PyExc_IOError , 1 },
1975+ {"OSError" , & PyExc_OSError , 1 },
19721976 {"ImportError" , & PyExc_ImportError , 1 },
19731977 {"IndexError" , & PyExc_IndexError , 1 },
19741978 {"KeyError" , & PyExc_KeyError , 1 },
@@ -2078,11 +2082,11 @@ initerrors(dict)
20782082 newstdexception (dict , bltin_exc [i ].name );
20792083 }
20802084
2081- /* This is kind of bogus because we special case the three new
2082- exceptions to be nearly forward compatible. But this means we
2083- hard code knowledge about exceptions.py into C here. I don't
2084- have a better solution, though
2085- */
2085+ /* This is kind of bogus because we special case the some of the
2086+ * new exceptions to be nearly forward compatible. But this means
2087+ * we hard code knowledge about exceptions.py into C here. I don't
2088+ * have a better solution, though.
2089+ */
20862090 PyExc_LookupError = PyTuple_New (2 );
20872091 Py_INCREF (PyExc_IndexError );
20882092 PyTuple_SET_ITEM (PyExc_LookupError , 0 , PyExc_IndexError );
@@ -2099,6 +2103,13 @@ initerrors(dict)
20992103 PyTuple_SET_ITEM (PyExc_ArithmeticError , 2 , PyExc_FloatingPointError );
21002104 PyDict_SetItemString (dict , "ArithmeticError" , PyExc_ArithmeticError );
21012105
2106+ PyExc_EnvironmentError = PyTuple_New (2 );
2107+ Py_INCREF (PyExc_IOError );
2108+ PyTuple_SET_ITEM (PyExc_EnvironmentError , 0 , PyExc_IOError );
2109+ Py_INCREF (PyExc_OSError );
2110+ PyTuple_SET_ITEM (PyExc_EnvironmentError , 1 , PyExc_OSError );
2111+ PyDict_SetItemString (dict , "EnvironmentError" , PyExc_EnvironmentError );
2112+
21022113 PyExc_StandardError = PyTuple_New (exccnt - 2 );
21032114 for (i = 2 ; bltin_exc [i ].name ; i ++ ) {
21042115 PyObject * exc = * bltin_exc [i ].exc ;
0 commit comments