8000 gh-120317: Lock around global state in the tokenize module by lysnikolaou · Pull Request #120318 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120317: Lock around global state in the tokenize module #120318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into tokenize-thread-safety
  • Loading branch information
lysnikolaou committed Jun 11, 2024
commit 975f01aa1a058b3583b8f579d83ca9900ada101c
5 changes: 4 additions & 1 deletion Python/Python-tokenize.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ _get_current_line(tokenizeriterobject *it, const char *line_start, Py_ssize_t si
Py_XDECREF(it->last_line);
line = PyUnicode_DecodeUTF8(line_start, size, "replace");
it->last_line = line;
it->byte_col_offset_diff = 0;
if (it->tok->lineno != it->last_end_lineno) {
it->byte_col_offset_diff = 0;
}
}
else {
// Line hasn't changed so we reuse the cached one.
Expand Down Expand Up @@ -226,6 +228,7 @@ _get_col_offsets(tokenizeriterobject *it, struct token token, const char *line_s
}
}
it->last_lineno = lineno;
it->last_end_lineno = end_lineno;
}

static PyObject *
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0