Author serhiy.storchaka
Recipients abarry, asmeurer, ncoghlan, r.david.murray, rhettinger, serhiy.storchaka
Date 2019-06-14.06:20:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560493231.09.0.888871160269.issue32912@roundup.psfhosted.org>
In-reply-to
Content
In the particular case of pyparsing there was a bug in the docstring.

     def sub(self, repl): 
         """ 
         Return Regex with an attached parse action to transform the parsed 
         result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_. 
  
         Example:: 
  
             make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>") 
             print(make_html.transformString("h1:main title:")) 
             # prints "<h1>main title</h1>" 
        """

\1 and \2 were interpreted as control characters U+0001 and U+0002, so the user could see 

        make_html = Regex(r"(\w+):(.*?):").sub(r"<^A>^B</^A>")

or

        make_html = Regex(r"(\w+):(.*?):").sub(r"<☺>☻</☺>")

or

        make_html = Regex(r"(\w+):(.*?):").sub(r"<></>")

depending on the output device.

So this examples proves the usefulness of the new warning.
History
Date User Action Args
2019-06-14 06:20:31serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, ncoghlan, r.david.murray, abarry, asmeurer
2019-06-14 06:20:31serhiy.storchakasetmessageid: <1560493231.09.0.888871160269.issue32912@roundup.psfhosted.org>
2019-06-14 06:20:31serhiy.storchakalinkissue32912 messages
2019-06-14 06:20:30serhiy.storchakacreate