bpo-35196: optimize Squeezer's write() interception - #10454
Conversation
|
When you're done making the requested changes, leave the comment: |
811214a to
b77de8c
Compare
|
@terryjreedy, following your comment on the subject, I did some timings with and without the second short-circuit check and found that it had no significant effect even in the most extreme cases it was meant to optimize. I've removed it to avoid the unnecessary complexity. |
This is cleaner and allows simplifying Squeezer.reload().
9275b43 to
485d954
Compare
Done. I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
|
I am reviewing this and making a few changes now. |
|
That assertion still fails on AppVeyor: What should we do with this? |
It passes locally on Windows 10, by the way. |
It fails on Travis-CI too :( Do we just drop this assertion? |
|
Cheryl's Ubuntu off-by-1 rounding failure and the CI no-change failures had different causes. I am experimenting with her suggested changes that avoid idleConf and expect to push something for the CI bots. Whoops, hit wrong comment button. |
| def load_font(self): | ||
| text = self.base_text | ||
| self.zero_char_width = \ | ||
| Font(text, name=text.cget('font')).measure('0') |
There was a problem hiding this comment.
Bug. The font name is a string added to tk's registry of fonts. The tuple gets turned into a string. Since I cannot accept a suggestion after making myself assignee (contrary to (i) information popup, I will change 'name' to 'font' in the web editor and see if it changes CI bots. (Test still pass on my machine.)
|
Thank you Cheryl, your suggestion works for the CI bots. After experimentation, I expect the new code should work even if a system does not have 'Courier'. On my machine, an unknown family is replaced by a default system font (Ariel, for me) and I assume that this is universal tk behavior. Tal, go ahead and merge. |
|
Thanks @taleinat for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
GH-11541 is a backport of this pull request to the 3.7 branch. |
The new functionality of Squeezer.reload() is also tested, along with some general re-working of the tests in test_squeezer.py. (cherry picked from commit 39a33e9) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
|
|
|
The problematic |
|
I will open a new issue and PR to fix this, initially by disabling it. I approved the backport since I will follow with the initial fix and I want 3.7 in sync with master. |

This also cleans up and improves the testing of
count_lines(), which has been significantly changed as part of this optimization.https://bugs.python.org/issue35196