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.14:22:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here is an extremely rough patch that shows the basic concept. I named the private function _PyUnicode_DecodeUnicodeEscape.

The problems with this patch are:
1. it always raises an error, not a warning
2. the private function isn't declared in a .h file
3. the name of the private function needs some thought
4. only the first invalid escape in a string is reported
5. I don't report the correct location in the string with the invalid escape
6. there may well be a memory leak
7. PEP 7 problems

#1 is because I was too lazy to refactor ast_error() to format the string I need without raising an error.

#5 could be solved with a callback and something to record multiple bad escapes per string, if we want to go that far. We'd have to decide how to show this. Multiple warnings, or one warning with multiple bad chars?

The rest of it is just quality of implementation stuff that we can work out if the approach is sound.
Date User Action Args
2016-09-16 14:22:12eric.smithsetrecipients: + eric.smith, brett.cannon, rhettinger, ncoghlan, ned.deily, r.david.murray, martin.panter, serhiy.storchaka, yselivanov, Tim.Graham, yan12125, abarry
2016-09-16 14:22:12eric.smithsetmessageid: <>
2016-09-16 14:22:12eric.smithlinkissue28128 messages
2016-09-16 14:22:12eric.smithcreate