changeset 80779:10d04bdb05ab 3.3

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.
author Antoine Pitrou <solipsis@pitrou.net>
date Sun, 09 Dec 2012 14:46:46 +0100
parents 3b67247f0bbb (current diff) d8300842a0e9 (diff)
children a4fc52da295b 3571a2808445
files Lib/tkinter/__init__.py Misc/NEWS
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/tkinter/__init__.py	Sun Dec 09 16:21:46 2012 +1000
+++ b/Lib/tkinter/__init__.py	Sun Dec 09 14:46:46 2012 +0100
@@ -1756,7 +1756,9 @@
         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()
--- a/Misc/NEWS	Sun Dec 09 16:21:46 2012 +1000
+++ b/Misc/NEWS	Sun Dec 09 14:46:46 2012 +0100
@@ -108,6 +108,9 @@
 Library
 -------
 
+- 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.
+
 - Issue #16628: Fix a memory leak in ctypes.resize().
 
 - Issue #13614: Fix setup.py register failure with invalid rst in description.