[issue37106] python re.escape doesn't escape some special characters.

MANI M report at bugs.python.org
Fri May 31 04:51:15 EDT 2019


MANI M <maannniii at gmail.com> added the comment:

I've scripts which insert data into MySQL database. The values may contain symbols. Hence in order to escape that I use re.escape(). @erik.smith isn't re.escape() supposed to escape all the symbols. If not why is this introduced in 3.7 whereas previous versions behave differently.

Example snippet:

import pymysql
from re import escape
def db_connection():
    ......
    ......
    ......

    # This throws error.
    query = " insert into table(column) values('{}'.format(escape("Hello'`~world")))

----------

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


More information about the Python-bugs-list mailing list