Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(164910)

Delta Between Two Patch Sets: Objects/bytesobject.c

Issue 28128: Improve the warning message for invalid escape sequences
Left Patch Set: Created 3 years, 1 month ago
Right Patch Set: Created 3 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_unicode.py ('k') | Objects/unicodeobject.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* bytes object implementation */ 1 /* bytes object implementation */
2 2
3 #define PY_SSIZE_T_CLEAN 3 #define PY_SSIZE_T_CLEAN
4 4
5 #include "Python.h" 5 #include "Python.h"
6 6
7 #include "bytes_methods.h" 7 #include "bytes_methods.h"
8 #include "pystrhex.h" 8 #include "pystrhex.h"
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 if (s < end && Py_ISXDIGIT(s[0])) 1208 if (s < end && Py_ISXDIGIT(s[0]))
1209 s++; /* and a hexdigit */ 1209 s++; /* and a hexdigit */
1210 break; 1210 break;
1211 1211
1212 default: 1212 default:
1213 if (*first_invalid_escape == NULL) { 1213 if (*first_invalid_escape == NULL) {
1214 *first_invalid_escape = s-1; /* Back up one char, since we've 1214 *first_invalid_escape = s-1; /* Back up one char, since we've
1215 already incremented s. */ 1215 already incremented s. */
1216 } 1216 }
1217 *p++ = '\\'; 1217 *p++ = '\\';
1218 s--;
1218 goto non_esc; /* an arbitrary number of unescaped 1219 goto non_esc; /* an arbitrary number of unescaped
1219 UTF-8 bytes may follow. */ 1220 UTF-8 bytes may follow. */
1220 } 1221 }
1221 } 1222 }
1222 1223
1223 return _PyBytesWriter_Finish(&writer, p); 1224 return _PyBytesWriter_Finish(&writer, p);
1224 1225
1225 failed: 1226 failed:
1226 _PyBytesWriter_Dealloc(&writer); 1227 _PyBytesWriter_Dealloc(&writer);
1227 return NULL; 1228 return NULL;
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 3408
3408 str = _PyBytesWriter_Prepare(writer, str, size); 3409 str = _PyBytesWriter_Prepare(writer, str, size);
3409 if (str == NULL) 3410 if (str == NULL)
3410 return NULL; 3411 return NULL;
3411 3412
3412 memcpy(str, bytes, size); 3413 memcpy(str, bytes, size);
3413 str += size; 3414 str += size;
3414 3415
3415 return str; 3416 return str;
3416 } 3417 }
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+