Chi Hsuan Yen added the comment: Currently the deprecation message is not so useful when fixing lots of files in a large project. For example, I have two files foo.py and bar.py:
# foo.py import bar # bar.py print('\d') It gives: $ python3.6 -W error foo.py Traceback (most recent call last): File "foo.py", line 1, in <module> import bar DeprecationWarning: invalid escape sequence '\d' Things are worse when __import__, imp or importlib are involved. I have to add some codes to show which module is imported. It would be better to have at least filenames and line numbers: $ ./python -W error foo.py Traceback (most recent call last): File "foo.py", line 1, in <module> import bar File "/home/yen/Projects/cpython/build/bar.py", line 1 print('\d') ^ SyntaxError: (deprecated usage) invalid escape sequence '\d' I have a naive try that prints more information. Raising SyntaxError may not be a good idea, anyway. ---------- nosy: +Chi Hsuan Yen Added file: http://bugs.python.org/file44550/verbose-deprecation.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27364> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com