Serhiy Storchaka added the comment:
DeprecationWarning is used when we want to remove a feature. It becomes an
error in the future. FutureWarning is used when we want change the meaning of a
feature instead of removing it. For example re.split(':*', 'a:bc') emits a
FutureWarning and returns ['a', 'bc'] because there is a plan to make it
returning ['', 'a', 'b', 'c', ''].
I think "a silent warning" means that it should emit a DeprecationWarning or a
PendingDeprecationWarning. Since there is no haste, we should use 2-releases
deprecation period. After this a deprecation can be changed to a SynataxWarning
in 3.8 and to a UnicodeDecodeError (for strings) and a ValueError (for bytes)
in 4.0. The latter are converted to SyntaxError by parser. At the end we should
get the same behavior as for truncated \x and \u escapes.
>>> '\u'
File "<stdin>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in
position 0-1: truncated \uXXXX escape
>>> b'\x'
File "<stdin>", line 1
SyntaxError: (value error) invalid \x escape at position 0
Maybe change a parser to convert warnings to a SyntaxWarning?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27364>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com