I am busy hacking on code in an attempt to make adodbapi actually work in three environments: CPython 2.3 to 2.6, CPython 3.0, and IronPython. One of the first things that failed, when attempting to run on Python 3.0, was the test for exception definitions. I quote:
The module should make all error information available through > these exceptions or subclasses thereof: > > Warning > > Exception raised for important warnings like data > truncations while inserting, etc. It must be a subclass of > the Python StandardError (defined in the module > exceptions). > > Error > > Exception that is the base class of all other error > exceptions. You can use this to catch all errors with one > single 'except' statement. Warnings are not considered > errors and thus should not use this class as base. It must > be a subclass of the Python StandardError (defined in the > module exceptions). > This is impossible with Python 3.0, since there is neither an "exceptions" module nor a "StandardError". Mark Hammond provided the following workaround: try: > from exceptions import StandardError as _BaseException > except ImportError: > # py3k > _BaseException = Exception > > class Error(_BaseException): > pass > > class Warning(_BaseException): > pass > This makes the code work fine, except that, by strict definition, it violates the api. So it would seem that we need to also patch the PEP. How is that done? -- Vernon Cole
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig