msg332559 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-12-26 18:50 |
This probably isn't a traceback that's likely to happen, but I wanted to document it since I was able to recreate it.
To recreate:
In a new shell, do Select All, then Find Selection.
Exception in Tkinter callback
Traceback (most recent call last):
File "N:\projects\cpython\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "N:\projects\cpython\lib\idlelib\editor.py", line 644, in find_selection_event
search.find_selection(self.text)
File "N:\projects\cpython\lib\idlelib\search.py", line 25, in find_selection
return _setup(text).find_selection(text)
File "N:\projects\cpython\lib\idlelib\search.py", line 72, in find_selection
return self.find_again(text)
File "N:\projects\cpython\lib\idlelib\search.py", line 65, in find_again
self.bell()
AttributeError: 'SearchDialog' object has no attribute 'bell'
|
msg332643 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2018-12-28 06:10 |
Thanks for reporting this. It is easy to trigger. And after a bit of analysis, easy to fix.
self.bell is set as top.bell in searchbase.SearchDialogBase.create_widgets(). The latter is called by SDB.open(), which is called for Find, Find-again if there is no previously defined pattern, and Find-in-files. It is not called by Find-selection as it uses the selection as the pattern.
The bell only sounds if the selection is not found anywhere else in the editor.
if selfirst == first and sellast == last:
self.bell()
If the selection is found elsewhere, the copy is then tagged with the selection tag, so when the original is found, the condition is not true. I consider it a bug that the selection tag is used instead of the 'found' tag, but the above depends on it being moved.
The purpose of creating and calling self.bell instead of top.bell is so bell can be mocked when testing, both to detect the call and suppress noise when testing. Binding self.bell to root.bell in __init__ instead of to top.bell in create_widgets should work fine.
|
msg332645 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2018-12-28 06:29 |
I expect that people have run into this. But since callback exceptions do not crash IDLE, the only symptom when not running from a terminal is the lack of the 'bell' sound.
|
msg332647 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2018-12-28 07:41 |
New changeset c465682718f15cd3deb6b37db5fb607718ac64ed by Terry Jan Reedy in branch 'master':
bpo-35591: IDLE Find Selection now works when selection not found (GH-11339)
https://github.com/python/cpython/commit/c465682718f15cd3deb6b37db5fb607718ac64ed
|
msg332652 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-12-28 10:31 |
New changeset 098bb249e9cf315b9e3b7d4bdad039a093d049c4 by Miss Islington (bot) in branch '3.7':
bpo-35591: IDLE Find Selection now works when selection not found (GH-11339)
https://github.com/python/cpython/commit/098bb249e9cf315b9e3b7d4bdad039a093d049c4
|
msg332662 - (view) |
Author: Cheryl Sabella (cheryl.sabella) *  |
Date: 2018-12-28 14:42 |
Thanks for looking at this one. :-)
|
|
Date |
User |
Action |
Args |
2022-04-11 14:59:09 | admin | set | github: 79772 |
2018-12-28 14:42:07 | cheryl.sabella | set | keywords:
patch, patch, patch
messages:
+ msg332662 |
2018-12-28 11:19:07 | terry.reedy | set | keywords:
patch, patch, patch status: open -> closed resolution: fixed stage: patch review -> resolved |
2018-12-28 10:31:36 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg332652
|
2018-12-28 10:19:13 | terry.reedy | set | pull_requests:
- pull_request10628 |
2018-12-28 10:19:01 | terry.reedy | set | pull_requests:
- pull_request10629 |
2018-12-28 10:17:25 | terry.reedy | set | keywords:
patch, patch, patch |
2018-12-28 10:14:15 | miss-islington | set | pull_requests:
+ pull_request10629 |
2018-12-28 10:14:10 | miss-islington | set | pull_requests:
+ pull_request10628 |
2018-12-28 10:14:04 | miss-islington | set | pull_requests:
+ pull_request10627 |
2018-12-28 07:43:19 | terry.reedy | set | pull_requests:
- pull_request10622 |
2018-12-28 07:43:08 | terry.reedy | set | pull_requests:
- pull_request10623 |
2018-12-28 07:42:01 | miss-islington | set | pull_requests:
+ pull_request10623 |
2018-12-28 07:41:55 | miss-islington | set | pull_requests:
+ pull_request10622 |
2018-12-28 07:41:50 | miss-islington | set | pull_requests:
+ pull_request10621 |
2018-12-28 07:41:43 | terry.reedy | set | messages:
+ msg332647 |
2018-12-28 06:29:37 | terry.reedy | set | keywords:
patch, patch, patch
messages:
+ msg332645 |
2018-12-28 06:24:02 | terry.reedy | set | pull_requests:
- pull_request10619 |
2018-12-28 06:23:52 | terry.reedy | set | pull_requests:
- pull_request10620 |
2018-12-28 06:22:52 | terry.reedy | set | keywords:
+ patch stage: commit review -> patch review pull_requests:
+ pull_request10620 |
2018-12-28 06:22:46 | terry.reedy | set | keywords:
+ patch stage: commit review -> commit review pull_requests:
+ pull_request10619 |
2018-12-28 06:22:40 | terry.reedy | set | keywords:
+ patch stage: commit review -> commit review pull_requests:
+ pull_request10618 |
2018-12-28 06:10:42 | terry.reedy | set | stage: commit review messages:
+ msg332643 versions:
+ Python 3.7 |
2018-12-26 18:50:50 | cheryl.sabella | create | |