Skip to content

Commit 6b5518a

Browse files
committed
Fix duplicated call to importlib._install_external_importers in pylifecycle.c
1 parent 8534d53 commit 6b5518a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Lib/test/test_sys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,9 @@ def check(tracebacklimit, expected):
852852
check(-1<<1000, [traceback[-1]])
853853
check(None, traceback)
854854

855+
def test_no_duplicates_in_meta_path(self):
856+
self.assertEqual(len(sys.meta_path), len(set(sys.meta_path)))
857+
855858

856859
@test.support.cpython_only
857860
class SizeofTest(unittest.TestCase):

Python/pylifecycle.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod)
325325

326326
/* Install importlib as the implementation of import */
327327
value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
328-
if (value != NULL) {
329-
Py_DECREF(value);
330-
value = PyObject_CallMethod(importlib,
331-
"_install_external_importers", "");
332-
}
333328
if (value == NULL) {
334329
PyErr_Print();
335330
return _Py_INIT_ERR("importlib install failed");

0 commit comments

Comments
 (0)