]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-140641: Break out of inittab search on match (GH-140642)
authorItamar Oren <itamarost@gmail.com>
Mon, 27 Oct 2025 13:18:58 +0000 (06:18 -0700)
committerGitHub <noreply@github.com>
Mon, 27 Oct 2025 13:18:58 +0000 (15:18 +0200)
Python/import.c

index d01c4d478283ff6ce1469ce2d887669e4e0b9a33..45206b46793846200ef8df897c7d154cee8b7c37 100644 (file)
@@ -2358,6 +2358,7 @@ create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec)
     for (struct _inittab *p = INITTAB; p->name != NULL; p++) {
         if (_PyUnicode_EqualToASCIIString(info.name, p->name)) {
             found = p;
+            break;
         }
     }
     if (found == NULL) {