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

Skip to content

Commit 0ee20eb

Browse files
committed
Issue #16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python.
Patch by Zachary Ware.
1 parent 2fd0b1a commit 0ee20eb

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/tkinter/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,9 @@ def __init__(self, screenName=None, baseName=None, className='Tk',
16321632
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
16331633
if useTk:
16341634
self._loadtk()
1635-
self.readprofile(baseName, className)
1635+
if not sys.flags.ignore_environment:
1636+
# Issue #16248: Honor the -E flag to avoid code injection.
1637+
self.readprofile(baseName, className)
16361638
def loadtk(self):
16371639
if not self._tkloaded:
16381640
self.tk.loadtk()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Core and Builtins
1313
Library
1414
-------
1515

16+
- Issue #16248: Disable code execution from the user's home directory by tkinter
17+
when the -E flag is passed to Python.
18+
1619

1720
What's New in Python 3.1.5?
1821
===========================

0 commit comments

Comments
 (0)