This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Tim.Graham, abarry, brett.cannon, eric.smith, martin.panter, ncoghlan, ned.deily, r.david.murray, rhettinger, serhiy.storchaka, yan12125, yselivanov
Date 2016-09-16.11:35:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474025715.56.0.508269116061.issue28128@psf.upfronthosting.co.za>
In-reply-to
Content
Couldn't we create a private version of PyUnicode_DecodeUnicodeEscape, to be called by ast.c, which passes back invalid escape info? Then have the actual warning raised by ast.c, which knows enough about the context to generate a better error/warning. I think we'd only be able to report on he first error in a string, though, but I haven't thought it all the way through.

I believe we'd only need to modify decode_unicode_with_escapes() in ast.c, which is called for both regular strings and f-string. And of course PyUnicode_DecodeUnicodeEscape would have to call the new private version and do the right thing.
History
Date User Action Args
2016-09-16 11:35:15eric.smithsetrecipients: + eric.smith, brett.cannon, rhettinger, ncoghlan, ned.deily, r.david.murray, martin.panter, serhiy.storchaka, yselivanov, Tim.Graham, yan12125, abarry
2016-09-16 11:35:15eric.smithsetmessageid: <1474025715.56.0.508269116061.issue28128@psf.upfronthosting.co.za>
2016-09-16 11:35:15eric.smithlinkissue28128 messages
2016-09-16 11:35:15eric.smithcreate