changeset: 80782:03b3124e9ea3 branch: 3.1 parent: 76255:5a6fa1b8767f user: Antoine Pitrou date: Sun Dec 09 14:46:18 2012 +0100 files: Lib/tkinter/__init__.py Misc/NEWS description: 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. diff -r 5a6fa1b8767f -r 03b3124e9ea3 Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py Wed Apr 11 16:46:54 2012 -0400 +++ b/Lib/tkinter/__init__.py Sun Dec 09 14:46:18 2012 +0100 @@ -1632,7 +1632,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() diff -r 5a6fa1b8767f -r 03b3124e9ea3 Misc/NEWS --- a/Misc/NEWS Wed Apr 11 16:46:54 2012 -0400 +++ b/Misc/NEWS Sun Dec 09 14:46:18 2012 +0100 @@ -13,6 +13,9 @@ Library ------- +- Issue #16248: Disable code execution from the user's home directory by tkinter + when the -E flag is passed to Python. + What's New in Python 3.1.5? ===========================