Message276715
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:12 | eric.smith | set | recipients:
+ 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:12 | eric.smith | set | messageid: <1474035732.57.0.16776622283.issue28128@psf.upfronthosting.co.za> |
2016-09-16 14:22:12 | eric.smith | link | issue28128 messages |
2016-09-16 14:22:12 | eric.smith | create | |
|