diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-06-12 13:11:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 13:11:59 (GMT) |
commit | be8b631b7a587aa781245e14c8cca32970e1be5b (patch) | |
tree | e754599e2e72d6e327667f1b8788f2d34d6fda36 /Parser/string_parser.c | |
parent | 9f1c5f6e8af6ba3f659b2aea1e221ac9695828ba (diff) | |
download | cpython-be8b631b7a587aa781245e14c8cca32970e1be5b.zip cpython-be8b631b7a587aa781245e14c8cca32970e1be5b.tar.gz cpython-be8b631b7a587aa781245e14c8cca32970e1be5b.tar.bz2 |
Add more const modifiers. (GH-26691)
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)++; } |