Wednesday, April 29, 2020
1 change · master
Enhancements to existing features
This update improves how the web interface interprets special characters in text values, making stored and displayed strings more reliable. It reduces the chance of formatting inconsistencies in features that rely on Python-like expressions in the browser.
Original PR description
Handling of escapes (`\`) was performed during evaluation rather than parsing, so strings in the AST stored the escaped form (rather than the proper one), and _formatAST had to mess around in order to try and get it back into a semblance of relevance (especially as the AST would store the escaped string without delimiters). Fix: perform the escapes handling (aka normalisation) during tokenization where it belongs. This means the AST formatter can now just JSON.stringify the data. Until and unless we decide to produce a cpython-compliant repr (https://github.com/python/cpython/blob/0169d3003be3d072751dd14a5c84748ab63a249f/Objects/unicodeobject.c#L12902-L13006) which is unlikely. This is the bit of Task 1941455 which I think is relevant. Cf comments there, the other bit is either a wontfix (notabug) or a feature change / request.