Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1813aa1

Browse files
committed
Issue #25488: Stpp idle.py from adding a entry when it is a duplicate.
Also, make idlelib.idle.main() work after import idlelib.idle.
1 parent 55f3ae6 commit 1813aa1

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Lib/idlelib/idle.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import os.path
22
import sys
33

4-
# If we are working on a development version of IDLE, we need to prepend the
5-
# parent of this idlelib dir to sys.path. Otherwise, importing idlelib gets
6-
# the version installed with the Python used to call this module:
4+
# Enable running IDLE with idlelib in a non-standard location.
5+
# This was once used to run development versions of IDLE.
6+
# Because PEP 434 declared idle.py a public interface,
7+
# removal should require deprecation.
78
idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
8-
sys.path.insert(0, idlelib_dir)
9+
if idlelib_dir not in sys.path:
10+
sys.path.insert(0, idlelib_dir)
911

10-
import idlelib.PyShell
11-
idlelib.PyShell.main()
12+
from idlelib.PyShell import main # This is subject to change
13+
main()

0 commit comments

Comments
 (0)