Message187418
| Author |
y-fujii |
| Recipients |
y-fujii |
| Date |
2013年04月20日.11:57:47 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1366459067.56.0.563805479218.issue17803@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Calling Tkinter.Tk() with baseName keyword argument throws UnboundLocalError on Python 2.7.4.
A process to reproduce the bug:
>>> import Tkinter
>>> Tkinter.Tk(baseName="test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1748, in __init__
if not sys.flags.ignore_environment:
UnboundLocalError: local variable 'sys' referenced before assignment
A patch to fix the bug:
--- Lib/lib-tk/Tkinter.py.orig
+++ Lib/lib-tk/Tkinter.py
@@ -1736,7 +1736,7 @@
# ensure that self.tk is always _something_.
self.tk = None
if baseName is None:
- import sys, os
+ import os
baseName = os.path.basename(sys.argv[0])
baseName, ext = os.path.splitext(baseName)
if ext not in ('.py', '.pyc', '.pyo'): |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年04月20日 11:57:47 | y-fujii | set | recipients:
+ y-fujii |
| 2013年04月20日 11:57:47 | y-fujii | set | messageid: <1366459067.56.0.563805479218.issue17803@psf.upfronthosting.co.za> |
| 2013年04月20日 11:57:47 | y-fujii | link | issue17803 messages |
| 2013年04月20日 11:57:47 | y-fujii | create |
|