[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 80c445cafbdfb16c4a882e3ff6fe28b471aacdfc by Serhiy Storchaka in branch '3.8': [3.8] bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781) (GH-23854)

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +22719 pull_request: https://github.com/python/cpython/pull/23854 ___ Python tracker ___

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 87e7a14ee3bd7dc495e51166598453114342d0bf by Serhiy Storchaka in branch '3.9': [3.9] bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781) (GH-23853)

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +22718 pull_request: https://github.com/python/cpython/pull/23853 ___ Python tracker ___

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3d569fd6dccf9f582bafaca04d3535094cae393e by Serhiy Storchaka in branch 'master': bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Ivo Shipkaliev
Ivo Shipkaliev added the comment: First: thank you! > I think Serhiy has done a very good job ... I'm not saying he ain't! More so, I greatly appreciate everyone's time and effort. But I'm discussing the implementation here, not somebody's work. Apparently I haven't been precise enough in

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Currently, a root window is created implicitly only when you create a Tkinter or Ttk widget. i.e. things which should be visible to user. When you create image, variable, or use global utility function like getbool() or mainloop() or image_types() it

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread E. Paine
E. Paine added the comment: > In my view, we should always create a default root if it's needed I somewhat disagree. I think Serhiy has done a very good job (in what I've reviewed so far) of balancing when a new root should or shouldn't be created (e.g. does it make sense to create a new

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Ivo Shipkaliev
Ivo Shipkaliev added the comment: Thank you very much, fellows! Serhiy, I'm lloking at Lib/tkinter/__init__.py changes. I'd like to share my thoughts on this: I understand your concern: "But I am not sure what is better: raise error (RuntimeError) if the global function uses _default_root

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +22639 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23781 ___ Python tracker ___

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Don't haste. I am currently working on a large PR with many tests. -- ___ Python tracker ___

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread E. Paine
E. Paine added the comment: > Are you gonna submit a PR I think I assumed you would incorporate it into your PR unless you would prefer it to be separate? -- ___ Python tracker

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread Ivo Shipkaliev
Ivo Shipkaliev added the comment: "Attached is a diff which ..." -- Much nicer! Are you gonna submit a PR so I can eventually use _setup_master() in my PR? -- ___ Python tracker

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread E. Paine
E. Paine added the comment: Attached is a diff which moves the logic for `setup_master` to the tkinter module while allowing it to still be imported from the tkinter.ttk module (in case someone uses it...) The diff also replaces the logic in a few other places to: A. make behaviour more

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread Ivo Shipkaliev
Ivo Shipkaliev added the comment: The current implementation is already relying on _some_ master anyway: 335 > self._root = master._root() So, initializing a default root, if one isn't present, shouldn't break anything. And reusing setup_master() is a good idea. Maybe: 333 > master

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread Ivo Shipkaliev
Change by Ivo Shipkaliev : -- resolution: works for me -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually it may be worth to reuse setup_master() from tkinter.ttk. But I am not sure what is better: raise error (RuntimeError) if the global function uses _default_root which is not initialized, or create the root widget implicitly. Currently

[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-14 Thread E. Paine
E. Paine added the comment: +1 I agree the current AttributeError is not suitable. I would just copy the code from Lib/tkinter/__init__.py:2524 (or even better: refactor it into its own method to avoid duplication). The code there, though, would raise a similar AttributeError if the default