summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-09 13:47:23 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-09 13:47:23 (GMT)
commitdb0420db17ab4cfff12b5aef9a7e90ac2b8b3c71 (patch)
treebf33ff0c62e25ed324e55968879a0bc76e894ad9 /Lib/tkinter
parentf9d0b1256fd5a9ae90fa8e8418bd450ec6b7f5f2 (diff)
parent373528f6b1d29a862189504384f31596ad4304d4 (diff)
downloadcpython-db0420db17ab4cfff12b5aef9a7e90ac2b8b3c71.zip
cpython-db0420db17ab4cfff12b5aef9a7e90ac2b8b3c71.tar.gz
cpython-db0420db17ab4cfff12b5aef9a7e90ac2b8b3c71.tar.bz2
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.
Diffstat (limited to 'Lib/tkinter')
-rw-r--r--Lib/tkinter/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 7c51a96..0e7b96d 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1756,7 +1756,9 @@ class Tk(Misc, Wm):
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
if useTk:
self._loadtk()
- self.readprofile(baseName, className)
+ if not sys.flags.ignore_environment:
+ # Issue #16248: Honor the -E flag to avoid code injection.
+ self.readprofile(baseName, className)
def loadtk(self):
if not self._tkloaded:
self.tk.loadtk()