bpo-34936: Fix TclError in tkinter.Spinbox.selection_element() by j4321 · Pull Request #9760 · python/cpython (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation16 Commits7 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

j4321

Spinbox.selection_element() raises TclError: expected integer but got "none" while it should return the currently selected element according to the docstring.

https://bugs.python.org/issue34936

@j4321

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to inline this method. It doesn't do something that deserves moving to a special method.

@j4321

@serhiy-storchaka I am not sure I understand what you mean. Should I just not use selection() in selection_element() and undo my changes of selection()?

@serhiy-storchaka

I suggest to use self.tk.call() in selection_element(). And maybe in other methods.

By the way, docstrings of some selection_* methods (containing "Returns an empty string.") are not correct.

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just added few nitpicks.

@@ -3750,25 +3750,25 @@ def selection_adjust(self, index):
select to commands. If the selection isn't currently in
the spinbox, then a new selection is created to include
the characters between index and the most recent selection
anchor point, inclusive. Returns an empty string.
anchor point, inclusive. Returns an empty tuple.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest just deleting the last sentence. It is not particularly useful.

@j4321

@j4321

serhiy-storchaka

@@ -522,6 +522,9 @@ def test_selection_methods(self):
self.assertEqual(widget.selection_get(), '2345')
widget.selection_adjust(0)
self.assertEqual(widget.selection_get(), '12345')
def test_selection_element_methods(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just test_selection_element.

@j4321

serhiy-storchaka

@miss-islington

Thanks @j4321 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@miss-islington

Thanks @j4321 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@miss-islington

Thanks @j4321 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@miss-islington

Sorry, @j4321 and @serhiy-storchaka, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 1deea5e53991b46351f6bb395b22365c9455ed88 3.6

@miss-islington

Sorry, @j4321 and @serhiy-storchaka, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 1deea5e53991b46351f6bb395b22365c9455ed88 3.7

@miss-islington

Sorry, @j4321 and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 1deea5e53991b46351f6bb395b22365c9455ed88 2.7

@serhiy-storchaka

Oh, conflicts. I suppose this is because of new methods and tests added in master only. Do you mind to backport this PR to the 3.7 branch @j4321? Then I think it will be possible to backport it from 3.7 to 3.6 automatically.

@j4321

@serhiy-storchaka I am not sure about what I am supposed to do. I just know that the backport pull request should be named "[3.7] bpo-34936: Fix TclError in tkinter.Spinbox.selection_element()(GH-9760)"

@bedevere-bot

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request

Oct 18, 2018

@CuriousLearner

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request

Oct 18, 2018

@CuriousLearner

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request

Oct 19, 2018

@j4321 @serhiy-storchaka

…pythonGH-9760).

(cherry picked from commit 1deea5e)

Co-authored-by: Juliette Monsel j4321@users.noreply.github.com

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Oct 19, 2018

@j4321 @miss-islington

miss-islington added a commit that referenced this pull request

Oct 19, 2018

@miss-islington @j4321

) (GH-9957)

(cherry picked from commit 1deea5e) (cherry picked from commit bd9c2ce)

Co-authored-by: Juliette Monsel j4321@users.noreply.github.com

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request

Oct 19, 2018

@j4321 @serhiy-storchaka

Labels

type-bug

An unexpected behavior, bug, or error