[issue39394] re: DeprecationWarning for `flag not at the start of expression` is cutoff too early

Jürgen Gmach report at bugs.python.org
Mon Jan 20 08:03:11 EST 2020


Jürgen Gmach <juergen.gmach at googlemail.com> added the comment:

> Why do you want to output the full regular expression?

The current output gives no clue about which flag is problematic, nor does it show the complete output (which at least would include the problematic flag), nor does it show the exact line, as it refers only to the line where compile gets called.

The warning points to following line ( https://github.com/jedie/python-creole/blob/4e74f29daaf5026a3d4d6dae9f2e74f5f3655439/creole/parser/creol2html_parser.py#L49-L50 ):

cell_re = re.compile(SpecialRules.cell, re.VERBOSE | re.UNICODE)


And SpecialRules.cell is a quite a big class ( https://github.com/jedie/python-creole/blob/4e74f29daaf5026a3d4d6dae9f2e74f5f3655439/creole/parser/creol2html_rules.py#L16-L97 ) defining lots of partial expressions.

Even if spotting this line ( https://github.com/jedie/python-creole/blob/4e74f29daaf5026a3d4d6dae9f2e74f5f3655439/creole/parser/creol2html_rules.py#L54 ) at the first glance it looks like it starts with the flag and should be correct (but is not as it turned out later).


> Is not source file path, line number, and starting 20 characters not enough to identify the affected regular expression?

It definitely was not enough for me (new to this code base as I only tried to report deprecation warnings in my application), and when you have a look at the comment ( https://github.com/jedie/python-creole/issues/31#issuecomment-575983117 ) it even was not enough for the author/maintainer of this package.

Do you expect any downside of printing the complete warning?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39394>
_______________________________________


More information about the Python-bugs-list mailing list