[Zope-dev] urgent: string exceptions
Fred L. Drake, Jr.
fred@zope.com
Fri, 11 Apr 2003 10:11:07 -0400
Chris McDonough writes:
> That'd be fine, but it would require a code audit. And third party
> products might fail.
Another issue with string exceptions is that starting with Python 2.3,
raising one will cause a PendingDeprecationWarning to be issued. Try
running Python 2.3 with the -Wall option to see these:
Python 2.3a2+ (#10, Mar 31 2003, 12:19:34)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raise 'foo'
__main__:1: PendingDeprecationWarning: raising a string exception is deprecated
Traceback (most recent call last):
File "<stdin>", line 1, in ?
foo
I think we should be very agressive about removing string exceptions,
replacing them with importable class-based exceptions derived from
Exception.
-Fred
--
Fred L. Drake, Jr. <fred at zope.com>
PythonLabs at Zope Corporation