diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-06-12 17:44:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 17:44:32 (GMT) |
commit | c43317d41e7248405f40864bcc62f675805f4fd0 (patch) | |
tree | 665e1cc2011cca8ca4d271e7ca34bd9be8302c23 /Parser/string_parser.c | |
parent | b441e99d89a3f05210cc36ade57699384986ca00 (diff) | |
download | cpython-c43317d41e7248405f40864bcc62f675805f4fd0.zip cpython-c43317d41e7248405f40864bcc62f675805f4fd0.tar.gz cpython-c43317d41e7248405f40864bcc62f675805f4fd0.tar.bz2 |
[3.10] Add more const modifiers. (GH-26691). (GH-26692)
(cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Parser/string_parser.c')
-rw-r--r-- | Parser/string_parser.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Parser/string_parser.c b/Parser/string_parser.c index fa41a36..66405b2 100644 --- a/Parser/string_parser.c +++ b/Parser/string_parser.c @@ -87,7 +87,7 @@ decode_unicode_with_escapes(Parser *parser, const char *s, size_t len, Token *t) if (*s & 0x80) { PyObject *w; int kind; - void *data; + const void *data; Py_ssize_t w_len; Py_ssize_t i; w = decode_utf8(&s, end); @@ -288,17 +288,17 @@ fstring_find_expr_location(Token *parent, char *expr_str, int *p_lines, int *p_c *p_lines = 0; *p_cols = 0; if (parent && parent->bytes) { - char *parent_str = PyBytes_AsString(parent->bytes); + const char *parent_str = PyBytes_AsString(parent->bytes); if (!parent_str) { return false; } - char *substr = strstr(parent_str, expr_str); + const char *substr = strstr(parent_str, expr_str); if (substr) { // The following is needed, in order to correctly shift the column // offset, in the case that (disregarding any whitespace) a newline // immediately follows the opening curly brace of the fstring expression. bool newline_after_brace = 1; - char *start = substr + 1; + const char *start = substr + 1; while (start && *start != '}' && *start != '\n') { if (*start != ' ' && *start != '\t' && *start != '\f') { newline_after_brace = 0; @@ -318,7 +318,7 @@ fstring_find_expr_location(Token *parent, char *expr_str, int *p_lines, int *p_c } /* adjust the start based on the number of newlines encountered before the f-string expression */ - for (char* p = parent_str; p < substr; p++) { + for (const char *p = parent_str; p < substr; p++) { if (*p == '\n') { (*p_lines)++; } |