homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Decorater, brett.cannon, eric.snow, gvanrossum, ncoghlan, r.david.murray, terry.reedy
Date 2016年07月15日.08:08:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468570121.7.0.9699112331.issue27515@psf.upfronthosting.co.za>
In-reply-to
Content
Decorator: as I tried to say in msg270456, the two examples are artificial tests stripped to the bare minimum. So is use of email and charset, other than the fact that it exists in 2.7 as well as current 3.x.
The real situation where this issue came up for me is the subprocess that IDLE uses to execute user code, separate as much as possible from IDLE code. idlelib.run imports tkinter. It them imports a few other idlelib modules that collectively import at least tkinter.font, tkinter.messagebox, and tkinter.simpledialog. These indirect imports change the tkinter module. Consequently, when users submit code such as
import tkinter as tk
root = tk.Tk()
myfont = tk.font.Font(...) # tk.font should raise NameError
it runs. But when they try to run their 'correct' program directly with Python, they get the NameError and must add, for instance, 'import tk.font'. IDLE should help people write standard python code, not python with a few custom augmentations.
My first attempt to fix this was to have run execute 'del tkinter.font', etcetera after the indirect imports are done. Then users would get the NameError they should. But currently, they would continue getting the NameError even after adding the needed import. This is because the first font import in *their* code is the second or later font import in the process. My second example is a condensed version of this failure.
History
Date User Action Args
2016年07月15日 08:08:41terry.reedysetrecipients: + terry.reedy, gvanrossum, brett.cannon, ncoghlan, r.david.murray, eric.snow, Decorater
2016年07月15日 08:08:41terry.reedysetmessageid: <1468570121.7.0.9699112331.issue27515@psf.upfronthosting.co.za>
2016年07月15日 08:08:41terry.reedylinkissue27515 messages
2016年07月15日 08:08:41terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /