[issue3423] DeprecationWarning message applies to wrong context with exec()

Terry J. Reedy report at bugs.python.org
Sun Jun 22 23:33:40 CEST 2014


Terry J. Reedy added the comment:

Zach, your header editing is inconsistent. If you think this is a bug rather than enhancement issue, please say why. Either way, what change you would make?  And even if you think there is a bug, why would you make a change in maintenance releases, given that we do not change exception messages in maintenance releases? Is the change you would make worth breaking doc tests?

Michael, your statement and posted link do not match. Installed 3.4.0 and locally built 3.5.0a0 both produce, for me,
Traceback (most recent call last):
  File "C:\Programs\Python34\tem.py", line 10, in <module>
    exec("raise 'two'")
  File "<string>", line 1, in <module>
TypeError: exceptions must derive from BaseException

2.7 produces
Traceback (most recent call last):
  File "C:\Programs\Python34\tem.py", line 10, in <module>
    exec("raise 'two'")
  File "<string>", line 1, in <module>
TypeError: exceptions must be old-style classes or derived from BaseException, not str

In other words, the string exception deprecation warning is obsolete and does not occur in any current Python.

The string.maketrans example is also obsolete as maketrans has been removed since 3.1. It now is an AttributeError. In 2.7, it is not deprecated.

----------
nosy: +zach.ware

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3423>
_______________________________________


More information about the Python-bugs-list mailing list