New submission from Gauchj <pythonb...@ga.uchj.de>:
_stringify escapes special characters so they can be processed by tcl/tk. To that end, two different escaping techniques are implemented: put a backslash in front of every special character or put the entire string in curly braces. However, a string like the following one: '"C:\\Windows\\System32\\notepad.exe" "afile.txt"' will be incorrectly escaped to '"C:\\\\Windows\\\\System32\\\\notepad.exe"\\ "afile.txt"' Tcl/TK will interpret this as a quoted string, but with a backslash after it (the one escaping the space between the quoted strings), throwing this exception: TclError('list element in quotes followed by "\\" instead of space',) The attached patch escapes this to '{"C:\\\\Windows\\\\System32\\\\notepad.exe" "afile.txt"}' I am not 100% sure that this is correct since double backslashes seem to be displayed now. ---------- components: Tkinter files: 0001-improve-escaping-of-quoted-strings.patch keywords: patch messages: 320508 nosy: gauchj priority: normal severity: normal status: open title: _stringify handles quoted strings incorrectly type: behavior versions: Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47654/0001-improve-escaping-of-quoted-strings.patch _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33974> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com