mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-29446: tkinter 'import *' only imports what it should (GH-14864)
Add __all__ to tkinter.__init__ and submodules. Replace 'import *' with explicit imports in some submodules.
This commit is contained in:
parent
c4cda4369f
commit
76b645124b
12 changed files with 52 additions and 15 deletions
|
@ -32,13 +32,13 @@ tk.mainloop()
|
|||
|
||||
import enum
|
||||
import sys
|
||||
import types
|
||||
|
||||
import _tkinter # If this fails your Python may not be configured for Tk
|
||||
TclError = _tkinter.TclError
|
||||
from tkinter.constants import *
|
||||
import re
|
||||
|
||||
|
||||
wantobjects = 1
|
||||
|
||||
TkVersion = float(_tkinter.TK_VERSION)
|
||||
|
@ -4569,5 +4569,9 @@ def _test():
|
|||
root.mainloop()
|
||||
|
||||
|
||||
__all__ = [name for name, obj in globals().items()
|
||||
if not name.startswith('_') and not isinstance(obj, types.ModuleType)
|
||||
and name not in {'wantobjects'}]
|
||||
|
||||
if __name__ == '__main__':
|
||||
_test()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue