[Python-3000-checkins] r55939 - in python/branches/p3yk: Doc/api/exceptions.tex Doc/lib/libdecimal.tex Doc/lib/libexcs.tex Doc/tut/tut.tex Include/pyerrors.h Lib/bsddb/dbtables.py Lib/sqlite3/test/dbapi.py Lib/test/exception_hierarchy.txt Lib/test/test_cgi.py Lib/test/test_pep352.py Lib/test/tf_inherit_check.py Lib/xml/dom/domreg.py Misc/Vim/python.vim Misc/cheatsheet Misc/python-mode.el Modules/_sqlite/module.c Objects/exceptions.c PC/os2emx/python25.def PC/os2vacpp/python.def
collin.winter
python-3000-checkins at python.org
Tue Jun 12 22:57:54 CEST 2007
Author: collin.winter
Date: Tue Jun 12 22:57:33 2007
New Revision: 55939
Modified:
python/branches/p3yk/Doc/api/exceptions.tex
python/branches/p3yk/Doc/lib/libdecimal.tex
python/branches/p3yk/Doc/lib/libexcs.tex
python/branches/p3yk/Doc/tut/tut.tex
python/branches/p3yk/Include/pyerrors.h
python/branches/p3yk/Lib/bsddb/dbtables.py
python/branches/p3yk/Lib/sqlite3/test/dbapi.py
python/branches/p3yk/Lib/test/exception_hierarchy.txt
python/branches/p3yk/Lib/test/test_cgi.py
python/branches/p3yk/Lib/test/test_pep352.py
python/branches/p3yk/Lib/test/tf_inherit_check.py
python/branches/p3yk/Lib/xml/dom/domreg.py
python/branches/p3yk/Misc/Vim/python.vim
python/branches/p3yk/Misc/cheatsheet
python/branches/p3yk/Misc/python-mode.el
python/branches/p3yk/Modules/_sqlite/module.c
python/branches/p3yk/Objects/exceptions.c
python/branches/p3yk/PC/os2emx/python25.def
python/branches/p3yk/PC/os2vacpp/python.def
Log:
Patch #1735485: remove StandardError from the exception hierarchy.
Modified: python/branches/p3yk/Doc/api/exceptions.tex
==============================================================================
--- python/branches/p3yk/Doc/api/exceptions.tex (original)
+++ python/branches/p3yk/Doc/api/exceptions.tex Tue Jun 12 22:57:33 2007
@@ -381,7 +381,6 @@
\begin{tableiii}{l|l|c}{cdata}{C Name}{Python Name}{Notes}
\lineiii{PyExc_BaseException\ttindex{PyExc_BaseException}}{\exception{BaseException}}{(1), (4)}
\lineiii{PyExc_Exception\ttindex{PyExc_Exception}}{\exception{Exception}}{(1)}
- \lineiii{PyExc_StandardError\ttindex{PyExc_StandardError}}{\exception{StandardError}}{(1)}
\lineiii{PyExc_ArithmeticError\ttindex{PyExc_ArithmeticError}}{\exception{ArithmeticError}}{(1)}
\lineiii{PyExc_LookupError\ttindex{PyExc_LookupError}}{\exception{LookupError}}{(1)}
\lineiii{PyExc_AssertionError\ttindex{PyExc_AssertionError}}{\exception{AssertionError}}{}
Modified: python/branches/p3yk/Doc/lib/libdecimal.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libdecimal.tex (original)
+++ python/branches/p3yk/Doc/lib/libdecimal.tex Tue Jun 12 22:57:33 2007
@@ -845,7 +845,7 @@
The following table summarizes the hierarchy of signals:
\begin{verbatim}
- exceptions.ArithmeticError(exceptions.StandardError)
+ exceptions.ArithmeticError(exceptions.Exception)
DecimalException
Clamped
DivisionByZero(DecimalException, exceptions.ZeroDivisionError)
Modified: python/branches/p3yk/Doc/lib/libexcs.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libexcs.tex (original)
+++ python/branches/p3yk/Doc/lib/libexcs.tex Tue Jun 12 22:57:33 2007
@@ -64,13 +64,6 @@
\versionchanged[Changed to inherit from \exception{BaseException}]{2.5}
\end{excdesc}
-\begin{excdesc}{StandardError}
-The base class for all built-in exceptions except
-\exception{StopIteration}, \exception{GeneratorExit},
-\exception{KeyboardInterrupt} and \exception{SystemExit}.
-\exception{StandardError} itself is derived from \exception{Exception}.
-\end{excdesc}
-
\begin{excdesc}{ArithmeticError}
The base class for those built-in exceptions that are raised for
various arithmetic errors: \exception{OverflowError},
@@ -143,9 +136,9 @@
\begin{excdesc}{GeneratorExit}
Raise when a generator's \method{close()} method is called.
- It directly inherits from \exception{Exception} instead of
- \exception{StandardError} since it is technically not an error.
\versionadded{2.5}
+ \versionchanged[Changed to inherit from Exception instead of
+ StandardError]{3.0}
\end{excdesc}
\begin{excdesc}{IOError}
@@ -257,10 +250,9 @@
\begin{excdesc}{StopIteration}
Raised by builtin \function{next()} and an iterator's \method{__next__()}
method to signal that there are no further values.
- This is derived from \exception{Exception} rather than
- \exception{StandardError}, since this is not considered an error in
- its normal application.
\versionadded{2.2}
+ \versionchanged[Changed to inherit from Exception instead of
+ StandardError]{3.0}
\end{excdesc}
@@ -304,7 +296,7 @@
Instances have an attribute \member{code} which is set to the
proposed exit status or error message (defaulting to \code{None}).
Also, this exception derives directly from \exception{BaseException} and
- not \exception{StandardError}, since it is not technically an error.
+ not \exception{Exception}, since it is not technically an error.
A call to \function{sys.exit()} is translated into an exception so that
clean-up handlers (\keyword{finally} clauses of \keyword{try} statements)
@@ -315,7 +307,7 @@
\function{fork()}).
The exception inherits from \exception{BaseException} instead of
- \exception{StandardError} or \exception{Exception} so that it is not
+ \exception{Exception} so that it is not
accidentally caught by code that catches \exception{Exception}. This allows
the exception to properly propagate up and cause the interpreter to exit.
\versionchanged[Changed to inherit from \exception{BaseException}]{2.5}
Modified: python/branches/p3yk/Doc/tut/tut.tex
==============================================================================
--- python/branches/p3yk/Doc/tut/tut.tex (original)
+++ python/branches/p3yk/Doc/tut/tut.tex Tue Jun 12 22:57:33 2007
@@ -2689,7 +2689,7 @@
'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented',
'NotImplementedError', 'OSError', 'OverflowError',
'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError',
- 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError',
+ 'RuntimeWarning', 'StopIteration', 'SyntaxError',
'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True',
'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError',
Modified: python/branches/p3yk/Include/pyerrors.h
==============================================================================
--- python/branches/p3yk/Include/pyerrors.h (original)
+++ python/branches/p3yk/Include/pyerrors.h Tue Jun 12 22:57:33 2007
@@ -107,7 +107,6 @@
PyAPI_DATA(PyObject *) PyExc_Exception;
PyAPI_DATA(PyObject *) PyExc_StopIteration;
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
-PyAPI_DATA(PyObject *) PyExc_StandardError;
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
PyAPI_DATA(PyObject *) PyExc_LookupError;
Modified: python/branches/p3yk/Lib/bsddb/dbtables.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/dbtables.py (original)
+++ python/branches/p3yk/Lib/bsddb/dbtables.py Tue Jun 12 22:57:33 2007
@@ -38,7 +38,7 @@
class DBIncompleteError(Exception):
pass
-class TableDBError(StandardError):
+class TableDBError(Exception):
pass
class TableAlreadyExists(TableDBError):
pass
Modified: python/branches/p3yk/Lib/sqlite3/test/dbapi.py
==============================================================================
--- python/branches/p3yk/Lib/sqlite3/test/dbapi.py (original)
+++ python/branches/p3yk/Lib/sqlite3/test/dbapi.py Tue Jun 12 22:57:33 2007
@@ -40,12 +40,12 @@
sqlite.paramstyle)
def CheckWarning(self):
- self.assert_(issubclass(sqlite.Warning, StandardError),
- "Warning is not a subclass of StandardError")
+ self.assert_(issubclass(sqlite.Warning, Exception),
+ "Warning is not a subclass of Exception")
def CheckError(self):
- self.failUnless(issubclass(sqlite.Error, StandardError),
- "Error is not a subclass of StandardError")
+ self.failUnless(issubclass(sqlite.Error, Exception),
+ "Error is not a subclass of Exception")
def CheckInterfaceError(self):
self.failUnless(issubclass(sqlite.InterfaceError, sqlite.Error),
Modified: python/branches/p3yk/Lib/test/exception_hierarchy.txt
==============================================================================
--- python/branches/p3yk/Lib/test/exception_hierarchy.txt (original)
+++ python/branches/p3yk/Lib/test/exception_hierarchy.txt Tue Jun 12 22:57:33 2007
@@ -4,39 +4,38 @@
+-- Exception
+-- GeneratorExit
+-- StopIteration
- +-- StandardError
- | +-- ArithmeticError
- | | +-- FloatingPointError
- | | +-- OverflowError
- | | +-- ZeroDivisionError
- | +-- AssertionError
- | +-- AttributeError
- | +-- EnvironmentError
- | | +-- IOError
- | | +-- OSError
- | | +-- WindowsError (Windows)
- | | +-- VMSError (VMS)
- | +-- EOFError
- | +-- ImportError
- | +-- LookupError
- | | +-- IndexError
- | | +-- KeyError
- | +-- MemoryError
- | +-- NameError
- | | +-- UnboundLocalError
- | +-- ReferenceError
- | +-- RuntimeError
- | | +-- NotImplementedError
- | +-- SyntaxError
- | | +-- IndentationError
- | | +-- TabError
- | +-- SystemError
- | +-- TypeError
- | +-- ValueError
- | | +-- UnicodeError
- | | +-- UnicodeDecodeError
- | | +-- UnicodeEncodeError
- | | +-- UnicodeTranslateError
+ +-- ArithmeticError
+ | +-- FloatingPointError
+ | +-- OverflowError
+ | +-- ZeroDivisionError
+ +-- AssertionError
+ +-- AttributeError
+ +-- EnvironmentError
+ | +-- IOError
+ | +-- OSError
+ | +-- WindowsError (Windows)
+ | +-- VMSError (VMS)
+ +-- EOFError
+ +-- ImportError
+ +-- LookupError
+ | +-- IndexError
+ | +-- KeyError
+ +-- MemoryError
+ +-- NameError
+ | +-- UnboundLocalError
+ +-- ReferenceError
+ +-- RuntimeError
+ | +-- NotImplementedError
+ +-- SyntaxError
+ | +-- IndentationError
+ | +-- TabError
+ +-- SystemError
+ +-- TypeError
+ +-- ValueError
+ | +-- UnicodeError
+ | +-- UnicodeDecodeError
+ | +-- UnicodeEncodeError
+ | +-- UnicodeTranslateError
+-- Warning
+-- DeprecationWarning
+-- PendingDeprecationWarning
Modified: python/branches/p3yk/Lib/test/test_cgi.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_cgi.py (original)
+++ python/branches/p3yk/Lib/test/test_cgi.py Tue Jun 12 22:57:33 2007
@@ -50,7 +50,7 @@
raise ValueError, "unknown method: %s" % method
try:
return cgi.parse(fp, env, strict_parsing=1)
- except StandardError as err:
+ except Exception as err:
return ComparableException(err)
# A list of test cases. Each test case is a a two-tuple that contains
Modified: python/branches/p3yk/Lib/test/test_pep352.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_pep352.py (original)
+++ python/branches/p3yk/Lib/test/test_pep352.py Tue Jun 12 22:57:33 2007
@@ -133,22 +133,22 @@
"""Catching 'object_' should raise a TypeError."""
try:
try:
- raise StandardError
+ raise Exception
except object_:
pass
except TypeError:
pass
- except StandardError:
+ except Exception:
self.fail("TypeError expected when catching %s" % type(object_))
try:
try:
- raise StandardError
+ raise Exception
except (object_,):
pass
except TypeError:
return
- except StandardError:
+ except Exception:
self.fail("TypeError expected when catching %s as specified in a "
"tuple" % type(object_))
Modified: python/branches/p3yk/Lib/test/tf_inherit_check.py
==============================================================================
--- python/branches/p3yk/Lib/test/tf_inherit_check.py (original)
+++ python/branches/p3yk/Lib/test/tf_inherit_check.py Tue Jun 12 22:57:33 2007
@@ -19,7 +19,7 @@
sys.stderr.write("fd %d is open in child" % fd)
sys.exit(1)
-except StandardError:
+except Exception:
if verbose:
raise
sys.exit(1)
Modified: python/branches/p3yk/Lib/xml/dom/domreg.py
==============================================================================
--- python/branches/p3yk/Lib/xml/dom/domreg.py (original)
+++ python/branches/p3yk/Lib/xml/dom/domreg.py Tue Jun 12 22:57:33 2007
@@ -72,7 +72,7 @@
for creator in well_known_implementations.keys():
try:
dom = getDOMImplementation(name = creator)
- except StandardError: # typically ImportError, or AttributeError
+ except Exception: # typically ImportError, or AttributeError
continue
if _good_enough(dom, features):
return dom
Modified: python/branches/p3yk/Misc/Vim/python.vim
==============================================================================
--- python/branches/p3yk/Misc/Vim/python.vim (original)
+++ python/branches/p3yk/Misc/Vim/python.vim Tue Jun 12 22:57:33 2007
@@ -88,7 +88,7 @@
syn keyword pythonException MemoryError NameError NotImplementedError
syn keyword pythonException OSError OverflowError PendingDeprecationWarning
syn keyword pythonException ReferenceError RuntimeError RuntimeWarning
- syn keyword pythonException StandardError StopIteration SyntaxError
+ syn keyword pythonException StopIteration SyntaxError
syn keyword pythonException SyntaxWarning SystemError SystemExit TabError
syn keyword pythonException TypeError UnboundLocalError UnicodeDecodeError
syn keyword pythonException UnicodeEncodeError UnicodeError
Modified: python/branches/p3yk/Misc/cheatsheet
==============================================================================
--- python/branches/p3yk/Misc/cheatsheet (original)
+++ python/branches/p3yk/Misc/cheatsheet Tue Jun 12 22:57:33 2007
@@ -779,8 +779,8 @@
class, the class name is printed, then a colon and a space, and
finally the instance converted to a string using the built-in function
str().
-All built-in exception classes derives from StandardError, itself
-derived from Exception.
+All built-in exception classes derives from Exception, itself
+derived from BaseException.
Name Space Statements
@@ -1051,9 +1051,6 @@
On 'sys.exit()'
StopIteration
Signal the end from iterator.__next__()
- StandardError
- Base class for all built-in exceptions; derived from Exception
- root class.
ArithmeticError
Base class for OverflowError, ZeroDivisionError,
FloatingPointError
Modified: python/branches/p3yk/Misc/python-mode.el
==============================================================================
--- python/branches/p3yk/Misc/python-mode.el (original)
+++ python/branches/p3yk/Misc/python-mode.el Tue Jun 12 22:57:33 2007
@@ -369,7 +369,7 @@
"NotImplementedError" "OSError" "OverflowError"
"OverflowWarning" "PendingDeprecationWarning"
"ReferenceError" "RuntimeError" "RuntimeWarning"
- "StandardError" "StopIteration" "SyntaxError"
+ "StopIteration" "SyntaxError"
"SyntaxWarning" "SystemError" "SystemExit"
"TabError" "True" "TypeError" "UnboundLocalError"
"UnicodeDecodeError" "UnicodeEncodeError"
Modified: python/branches/p3yk/Modules/_sqlite/module.c
==============================================================================
--- python/branches/p3yk/Modules/_sqlite/module.c (original)
+++ python/branches/p3yk/Modules/_sqlite/module.c Tue Jun 12 22:57:33 2007
@@ -287,12 +287,12 @@
/*** Create DB-API Exception hierarchy */
- if (!(pysqlite_Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_StandardError, NULL))) {
+ if (!(pysqlite_Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_Exception, NULL))) {
goto error;
}
PyDict_SetItemString(dict, "Error", pysqlite_Error);
- if (!(pysqlite_Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_StandardError, NULL))) {
+ if (!(pysqlite_Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_Exception, NULL))) {
goto error;
}
PyDict_SetItemString(dict, "Warning", pysqlite_Warning);
Modified: python/branches/p3yk/Objects/exceptions.c
==============================================================================
--- python/branches/p3yk/Objects/exceptions.c (original)
+++ python/branches/p3yk/Objects/exceptions.c Tue Jun 12 22:57:33 2007
@@ -334,17 +334,9 @@
/*
- * StandardError extends Exception
+ * TypeError extends Exception
*/
-SimpleExtendsException(PyExc_Exception, StandardError,
- "Base class for all standard Python exceptions that do not represent\n"
- "interpreter exiting.");
-
-
-/*
- * TypeError extends StandardError
- */
-SimpleExtendsException(PyExc_StandardError, TypeError,
+SimpleExtendsException(PyExc_Exception, TypeError,
"Inappropriate argument type.");
@@ -425,14 +417,14 @@
/*
- * ImportError extends StandardError
+ * ImportError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, ImportError,
+SimpleExtendsException(PyExc_Exception, ImportError,
"Import can't find module, or can't find name in module.");
/*
- * EnvironmentError extends StandardError
+ * EnvironmentError extends Exception
*/
/* Where a function has a single filename, such as open() or some
@@ -657,7 +649,7 @@
{NULL}
};
-ComplexExtendsException(PyExc_StandardError, EnvironmentError,
+ComplexExtendsException(PyExc_Exception, EnvironmentError,
EnvironmentError, EnvironmentError_dealloc,
EnvironmentError_methods, EnvironmentError_members,
EnvironmentError_str,
@@ -867,16 +859,16 @@
/*
- * EOFError extends StandardError
+ * EOFError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, EOFError,
+SimpleExtendsException(PyExc_Exception, EOFError,
"Read beyond end of file.");
/*
- * RuntimeError extends StandardError
+ * RuntimeError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, RuntimeError,
+SimpleExtendsException(PyExc_Exception, RuntimeError,
"Unspecified run-time error.");
@@ -887,9 +879,9 @@
"Method or function hasn't been implemented yet.");
/*
- * NameError extends StandardError
+ * NameError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, NameError,
+SimpleExtendsException(PyExc_Exception, NameError,
"Name not found globally.");
/*
@@ -899,14 +891,14 @@
"Local name referenced but not bound to a value.");
/*
- * AttributeError extends StandardError
+ * AttributeError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, AttributeError,
+SimpleExtendsException(PyExc_Exception, AttributeError,
"Attribute not found.");
/*
- * SyntaxError extends StandardError
+ * SyntaxError extends Exception
*/
static int
@@ -1085,7 +1077,7 @@
{NULL} /* Sentinel */
};
-ComplexExtendsException(PyExc_StandardError, SyntaxError, SyntaxError,
+ComplexExtendsException(PyExc_Exception, SyntaxError, SyntaxError,
SyntaxError_dealloc, 0, SyntaxError_members,
SyntaxError_str, "Invalid syntax.");
@@ -1105,9 +1097,9 @@
/*
- * LookupError extends StandardError
+ * LookupError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, LookupError,
+SimpleExtendsException(PyExc_Exception, LookupError,
"Base class for lookup errors.");
@@ -1144,9 +1136,9 @@
/*
- * ValueError extends StandardError
+ * ValueError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, ValueError,
+SimpleExtendsException(PyExc_Exception, ValueError,
"Inappropriate argument value (of correct type).");
/*
@@ -1763,16 +1755,16 @@
/*
- * AssertionError extends StandardError
+ * AssertionError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, AssertionError,
+SimpleExtendsException(PyExc_Exception, AssertionError,
"Assertion failed.");
/*
- * ArithmeticError extends StandardError
+ * ArithmeticError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, ArithmeticError,
+SimpleExtendsException(PyExc_Exception, ArithmeticError,
"Base class for arithmetic errors.");
@@ -1798,9 +1790,9 @@
/*
- * SystemError extends StandardError
+ * SystemError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, SystemError,
+SimpleExtendsException(PyExc_Exception, SystemError,
"Internal error in the Python interpreter.\n"
"\n"
"Please report this to the Python maintainer, along with the traceback,\n"
@@ -1808,16 +1800,16 @@
/*
- * ReferenceError extends StandardError
+ * ReferenceError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, ReferenceError,
+SimpleExtendsException(PyExc_Exception, ReferenceError,
"Weak ref proxy used after referent went away.");
/*
- * MemoryError extends StandardError
+ * MemoryError extends Exception
*/
-SimpleExtendsException(PyExc_StandardError, MemoryError, "Out of memory.");
+SimpleExtendsException(PyExc_Exception, MemoryError, "Out of memory.");
/* Warning category docstrings */
@@ -1930,7 +1922,6 @@
PRE_INIT(BaseException)
PRE_INIT(Exception)
- PRE_INIT(StandardError)
PRE_INIT(TypeError)
PRE_INIT(StopIteration)
PRE_INIT(GeneratorExit)
@@ -1992,7 +1983,6 @@
POST_INIT(BaseException)
POST_INIT(Exception)
- POST_INIT(StandardError)
POST_INIT(TypeError)
POST_INIT(StopIteration)
POST_INIT(GeneratorExit)
Modified: python/branches/p3yk/PC/os2emx/python25.def
==============================================================================
--- python/branches/p3yk/PC/os2emx/python25.def (original)
+++ python/branches/p3yk/PC/os2emx/python25.def Tue Jun 12 22:57:33 2007
@@ -767,7 +767,6 @@
"_PyExc_Fini"
"PyExc_BaseException"
"PyExc_Exception"
- "PyExc_StandardError"
"PyExc_TypeError"
"PyExc_StopIteration"
"PyExc_GeneratorExit"
Modified: python/branches/p3yk/PC/os2vacpp/python.def
==============================================================================
--- python/branches/p3yk/PC/os2vacpp/python.def (original)
+++ python/branches/p3yk/PC/os2vacpp/python.def Tue Jun 12 22:57:33 2007
@@ -30,7 +30,6 @@
PyExc_OSError
PyExc_OverflowError
PyExc_RuntimeError
- PyExc_StandardError
PyExc_SyntaxError
PyExc_SystemError
PyExc_SystemExit
More information about the Python-3000-checkins
mailing list