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

Skip to content

Commit f25d957

Browse files
committed
- Issue python#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 55f23c4 commit f25d957

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/lib-tk/Tkinter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,9 @@ def __init__(self, screenName=None, baseName=None, className='Tk',
16431643
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
16441644
if useTk:
16451645
self._loadtk()
1646-
self.readprofile(baseName, className)
1646+
if not sys.flags.ignore_environment:
1647+
# Issue #16248: Honor the -E flag to avoid code injection.
1648+
self.readprofile(baseName, className)
16471649
def loadtk(self):
16481650
if not self._tkloaded:
16491651
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
17+
tkinter when the -E flag is passed to Python. Patch by Zachary Ware.
18+
1619

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

0 commit comments

Comments
 (0)