Visitar URL original
gh-119584: Fix test_import Failed Assertion by ericsnowcurrently · Pull Request #119623 · python/cpython · GitHub
Skip to content
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
Fix _modules_by_index_check().
  • Loading branch information
ericsnowcurrently committed May 27, 2024
commit 7a23841d787c07a84b5537095768ae1eb4e85fa6
2 changes: 1 addition & 1 deletion Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ _modules_by_index_check(PyInterpreterState *interp, Py_ssize_t index)
if (MODULES_BY_INDEX(interp) == NULL) {
return "Interpreters module-list not accessible.";
}
if (index > PyList_GET_SIZE(MODULES_BY_INDEX(interp))) {
if (index >= PyList_GET_SIZE(MODULES_BY_INDEX(interp))) {
return "Module index out of bounds.";
}
return NULL;
Expand Down