Python 2.3c1: Raising a string doesn't trigger PendingDeprecationWarning.

Andrew Bennetts andrew-pythonlist at puzzling.org
Wed Jul 23 05:40:08 EDT 2003


On Wed, Jul 23, 2003 at 01:27:54AM -0700, Kerim wrote:
> "What's New in Python 2.3"
> (http://www.python.org/doc/2.3c1/whatsnew/node17.html) says that
> "Raising a string will now trigger PendingDeprecationWarning.". But
> with Python 2.3c1 it seems that it isn't the case:
> 
> Python 2.3c1 (#44, Jul 18 2003, 14:32:36) [MSC v.1200 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> raise 'error'
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> error
> >>>

By default, the warnings module is configured to ignore
PendingDeprecationWarnings (as opposed to DeprecationWarnings).  If you
instruct it otherwise, e.g. with -Wall, it does what you expect:

bash-2.05b$ python2.3 -Wall
Python 2.3b2+ (#2, Jul  5 2003, 11:28:28) 
[GCC 3.3.1 20030626 (Debian prerelease)] 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
>>> 

-Andrew.






More information about the Python-list mailing list