]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #16893: Move idlelib.EditorWindow.HelpDialog deprecation warning
authorTerry Jan Reedy <tjreedy@udel.edu>
Wed, 23 Sep 2015 02:59:35 +0000 (22:59 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Wed, 23 Sep 2015 02:59:35 +0000 (22:59 -0400)
so it is not triggered on import.  The problem is creation of a now-unused
instance "helpDialog = HelpDialog()", left for back compatibility.
So instead trigger the warning when that instance or another is used.

Lib/idlelib/EditorWindow.py

index f9f53376abf5662a29e4256e0fe61a70d2d26ca0..f78fe53ef4cf2663db84d9fc31c8ede7a3d09bcc 100644 (file)
@@ -72,11 +72,6 @@ def _find_module(fullname, path=None):
 class HelpDialog(object):
 
     def __init__(self):
-        import warnings as w
-        w.warn("EditorWindow.HelpDialog is no longer used by Idle.\n"
-               "It will be removed in 3.6 or later.\n"
-               "It has been replaced by private help.HelpWindow\n",
-               DeprecationWarning, stacklevel=2)
         self.parent = None      # parent of help window
         self.dlg = None         # the help window iteself
 
@@ -88,6 +83,11 @@ class HelpDialog(object):
             near - a Toplevel widget (e.g. EditorWindow or PyShell)
                    to use as a reference for placing the help window
         """
+        import warnings as w
+        w.warn("EditorWindow.HelpDialog is no longer used by Idle.\n"
+               "It will be removed in 3.6 or later.\n"
+               "It has been replaced by private help.HelpWindow\n",
+               DeprecationWarning, stacklevel=2)
         if self.dlg is None:
             self.show_dialog(parent)
         if near: