summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 4f3325a..6fe6df4 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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;
@@ -2183,7 +2183,7 @@ clear_singlephase_extension(PyInterpreterState *interp,
/* Clear data set when the module was initially loaded. */
def->m_base.m_init = NULL;
Py_CLEAR(def->m_base.m_copy);
- // We leave m_index alone since there's no reason to reset it.
+ def->m_base.m_index = 0;
/* Clear the PyState_*Module() cache entry. */
Py_ssize_t index = _get_cached_module_index(cached);