[issue15251] new.code and new.function crashes Python iterpretter

2021-10-18 Thread Tal Einat


Tal Einat  added the comment:

I couldn't reproduce this on the latest main branch with an updated version of 
the code sample (see attached repro.py). I also couldn't get such a crash with 
some variations of this.

I'm marking this as fixed for now. We can re-open this if anyone runs into an 
up-to-date case of this crash.

--
nosy: +taleinat
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
Added file: https://bugs.python.org/file50368/repro.py

___
Python tracker 
<https://bugs.python.org/issue15251>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19459] Python does not support the GEORGIAN-PS charset

2021-10-18 Thread Tal Einat


Tal Einat  added the comment:

With recent versions of Python (e.g. 3.9) this no longer causes a crash. Python 
apparently falls back to UTF-8, at least on my system:

$ LANG=ka_GE.georgianps python3.9
Python 3.9.7 (default, Sep  9 2021, 23:20:13) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale; print(locale.getpreferredencoding())
UTF-8

I'm marking this as fixed. If someone still has issues with this encoding, 
please open a new issue with up-to-date information.

--
nosy: +taleinat
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue19459>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45296] IDLE: Change Ctrl-Z note in exit/quit repr on Windows

2021-09-27 Thread Tal Einat


Tal Einat  added the comment:

How about "Control-D (end-of-file, a.k.a. EOF)" or even just "Control-D"?

--

___
Python tracker 
<https://bugs.python.org/issue45296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40128] IDLE Show completions pop-up not working on macOS

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

Pablo, I'm not sure what you cherry-picked, but this fix for macOS broke the 
completions pop-up on Linux, and that appears to still be the state of things 
now on the 3.10.0 branch. Let's please not leave things this way if at all 
possible.

--

___
Python tracker 
<https://bugs.python.org/issue40128>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-28328 with proposed fix. It should be tested on macOS with several 
relevant versions of Tcl/Tk to ensure that the Tk version range used is correct.

--

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +26739
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/28328

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Change by Tal Einat :


--
stage: patch review -> needs patch

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -26735

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +26735
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26039

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

I've also tested this on Windows 10 with the latest main branch (to be 3.11). 
The completions window works as expected with or without the recently added 
.update_idletasks() call.

I do recommend limiting this to macOS (platform.system() == "Darwin"). 

Ideally we'd test this on macOS with several versions of tcl/tk (8.6.8, 8.6.9, 
8.6.10, 8.6.11) and limit it to only those versions where the fix is required:

TK_VERSION = tuple(map(int, tk.call("info", "patchlevel").split(".")))
if (8, 6, 8) <= TK_VERSION < (8, 6, 10):
acw.update_idletasks()

Also we might check if calling .update() is enough, since that does less than 
.update_idletasks().

--

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40128] IDLE Show completions pop-up not working on macOS

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

I've created a separate issue for the completion window not appearing on Linux, 
issue #45193. Let's move the discussion there.

--

___
Python tracker 
<https://bugs.python.org/issue40128>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2021-09-14 Thread Tal Einat


New submission from Tal Einat :

The completion window never appears with Python version 3.9.7 and with the 
current main branch.

Ubuntu 20.04 (reproduced on two separate machines)
Tested with Tcl/Tk versions 8.6.10 and 8.6.11.

This is directly caused by the fix for issue #40128. Commenting out that line 
resolves this issue entirely.

(See also the PR for that fix, PR GH-26672.)

--
assignee: terry.reedy
components: IDLE
messages: 401758
nosy: taleinat, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE Show completions pop-up not working on Ubuntu Linux
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue45193>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40128] IDLE Show completions pop-up not working on macOS

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

Note that _tkinter.TK_VERSION and _tkinter.TK_VERSION are simply "8.6", not 
enough to differentiate between patch versions. The best way to get this info 
appears to be tk.call("info", "patchlevel").

Specifically I suggest:

TK_VERSION = tuple(map(int, tk.call("info", "patchlevel").split(".")))

...

if (8, 6, 8) <= TK_VERSION < (8, 6, 10):
...

--

___
Python tracker 
<https://bugs.python.org/issue40128>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40128] IDLE Show completions pop-up not working on macOS

2021-09-14 Thread Tal Einat


Tal Einat  added the comment:

Confirmed with python 3.9.7 installed via the "deadsnakes" apt repo on another 
Ubuntu 20.04 machine.

"Confirmed" meaning specifically that the completion window never appears, and 
commenting out that single line resolves the issue.

--

___
Python tracker 
<https://bugs.python.org/issue40128>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array

2021-08-25 Thread Tal Einat


Change by Tal Einat :


--
nosy:  -taleinat

___
Python tracker 
<https://bugs.python.org/issue39218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44325] IDLE: Fix shell comment anomalies

2021-06-07 Thread Tal Einat


Tal Einat  added the comment:

The sidebar doesn't seem to be causing this issue, it's just making it a bit 
more visible, since what was previously a blank line now also has a more 
visible "..." continuation prompt.

--

___
Python tracker 
<https://bugs.python.org/issue44325>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44325] IDLE: Fix shell comment anomalies

2021-06-07 Thread Tal Einat


Tal Einat  added the comment:

> However, I sometimes saw ... appear very briefly, only to be overwritten with 
> >>>.

This is a known limitation of the current sidebar implementation, which was 
very difficult to avoid and was considered minor enough to let be for now.

--

___
Python tracker 
<https://bugs.python.org/issue44325>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44325] IDLE: Fix shell comment anomalies

2021-06-07 Thread Tal Einat


Tal Einat  added the comment:

> 1) trailing whitespace (' ' and '\t' at least) is removed before this 
> function is called.  I presume in IDLE rather than code.II, but cannot find 
> where.  It is not with .rstrip.

You're probably looking for this code in 
EditorWindow.newline_and_indent_event():

# Strip whitespace after insert point.
while text.get("insert") in " \t":
text.delete("insert")

See: 
https://github.com/python/cpython/blob/89e50ab36fac6a0e7f1998501f36fcd2872a6604/Lib/idlelib/editor.py#L1390

--

___
Python tracker 
<https://bugs.python.org/issue44325>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40468] IDLE: configdialog tab rearrange

2021-06-06 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +25149
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26561

___
Python tracker 
<https://bugs.python.org/issue40468>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37768] IDLE: Show help(object) output in a text viewer

2021-06-06 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +25150
pull_request: https://github.com/python/cpython/pull/26561

___
Python tracker 
<https://bugs.python.org/issue37768>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Fix tab completion after settings and some keys

2021-06-06 Thread Tal Einat


Tal Einat  added the comment:

> The unknown is whether anyone has changed these pseudoevent bindings and if 
> so, how much do we care?

Let's ask on idle-dev.

> Guido, do you have any comment on this proposal from a change policy 
> perspective?

I'm not an ex-BDFL, but I can't think of a reason this shouldn't be backported 
as per our usual policy regarding IDLE.

--

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-26491.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +25087
pull_request: https://github.com/python/cpython/pull/26491

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

On my machine it running the test many times with parallelization no longer 
causes any failures with this change.  Also, running other tests which us the 
@run_in_tk_mainloop decorator, with the same 1ms delay as before, doesn't cause 
any such failures.  PR forthcoming.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

> Running 12 duplicate tests in parallel on Windows on a 6 core (12 CPU) 
> machine with [...] resulted in nearly all failing.

Yes, running test_idle in parallel with itself usually causes some failures due 
to UI focus being stolen from one instance by another.  That's why I just ran 
this test rather than the whole test suite.

> I am reluctant to add a delay that is mostly not needed, so i tried the 
> uploaded 'adaptive' code to only add a long delay if needed.  Uploaded.  But 
> when a tested failed once, it failed again even with the delay, and contrary 
> to the results above.

The delay needs to be placed carefully.  Changing root.after(1, ...) to use 50 
rather than 1 (these are milliseconds) seems to resolve the issue entirely on 
my machine, at the cost of this single test taking 0.4 seconds to run rather 
than about 0.045 seconds.

> The other thing I thought is parameterizing the decorator to pass in a delay 
> only for this test, but that require another layer of wrapping, which I 
> cannot do right now.

I can do that.  Though I fear this may happen for other such tests as well...  
Worth a shot I guess.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

On Ubuntu 20.04, I've managed to occasionally get this issue to reproduce 
locally by running the test many times in parallel, repeatedly:

parallel -n8 -N0 './python -m test -ugui test_idle -m test_colorizer' ::: $(seq 
20)

This appears to be an issue with our new method of running tests with a Tk 
mainloop in the background, using the @run_in_tk_mainloop decorator.

Investigating further.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

I'm investigating this now. If nothing obvious comes up, I'll revert that PR.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

The latest PR where changes were made to IDLE's colorizer and its tests, 
including specifically adding the problematic test, is GH-25851.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-02 Thread Tal Einat


Tal Einat  added the comment:

Please note that the referenced PR is not the correct one.

I'll add a link to the right one shortly.

--

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44282] IDLE: ColorDelegatorTest test_incremental_editing failures

2021-06-01 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +25076
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26404

___
Python tracker 
<https://bugs.python.org/issue44282>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30495] IDLE: modernize textview module

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:

Ping? ISTM this could be considered done.

--
nosy: +taleinat

___
Python tracker 
<https://bugs.python.org/issue30495>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42831] IDLE fix colours for MacOS dark mode

2021-05-28 Thread Tal Einat


Change by Tal Einat :


--
keywords: +easy, newcomer friendly
stage:  -> needs patch
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue42831>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23937] IDLE: revise window size, placement startup options

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:

> When I changed the title, I intended to broaden the issue beyond 'start 
> maximized'.  Even for that, there are two possibilities. 1. Configure option 
> (default as now).  2. Save 'current' position, which helps non-maximizers 
> also.  So I am inclined to the latter with some definition of current.

Ah, now I understand better, thanks for the clarification.

I currently consider this is a rather low priority.

--

___
Python tracker 
<https://bugs.python.org/issue23937>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23937] IDLE: revise window size, placement startup options

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:

> There is a subtle issue easy to not notice.  Scrolling is slightly different 
> when the window height an integral number of lines, as it now is on startup, 
> or pixels, as after resizing with zoom or mouse grab.  I believe 'lines' is 
> enough better that I have considered snapping to 'lines' after changes.  Not 
> now though.

This is mostly a separate issue.  I certainly think that scrolling should be 
consistent, independent of whether the window show a whole or fractional number 
of lines.  Terry, is there an issue open about that or shall we open one?

> The Settings dialog height is currently determined by the General tab.  It is 
> already too high for some notebooks: on my macbook, I can barely click OK 
> (with 'OK' not visible) *after* putting the app bar on the side rather than 
> bottom.  We need to squeeze existing items rather than add another.

This is entirely separate.  It has been mentioned before, but again I'm not 
aware of an existing issue specifically about this.  If there isn't one, let's 
create one and discuss there.

--

___
Python tracker 
<https://bugs.python.org/issue23937>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:

Both the original bug reported here, and the bug whereby completion could cause 
IDLE to freeze on macOS, have been fixed and backported to 3.10 and 3.9.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:


New changeset 21a56a4bce186cd19a50502d2de5117551616005 by Miss Islington (bot) 
in branch '3.9':
bpo-41611: IDLE: Catch TclError exceptions in 
AutoCompleteWindow.winconfig_event() (GH-26404)
https://github.com/python/cpython/commit/21a56a4bce186cd19a50502d2de5117551616005


--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:


New changeset 448abe8d8bcfdf50a5ecae1196199da46bdfed04 by Miss Islington (bot) 
in branch '3.10':
bpo-41611: IDLE: Catch TclError exceptions in 
AutoCompleteWindow.winconfig_event() (GH-26404)
https://github.com/python/cpython/commit/448abe8d8bcfdf50a5ecae1196199da46bdfed04


--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Applying settings disables tab completion

2021-05-28 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +25016
pull_request: https://github.com/python/cpython/pull/26421

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-28 Thread Tal Einat


Tal Einat  added the comment:


New changeset 4e2e5c1c4f792b4011e4c78d011baea2aee39f1b by Tal Einat in branch 
'main':
bpo-41611: IDLE: Catch TclError exceptions in 
AutoCompleteWindow.winconfig_event() (GH-26404)
https://github.com/python/cpython/commit/4e2e5c1c4f792b4011e4c78d011baea2aee39f1b


--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23937] IDLE: revise window size, placement startup options

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

In terms of its interface, IDLE is more like a REPL + text editor than what is 
commonly thought of as programming IDEs (Visual Studio, PyCharm/IDEA, Matlab, 
JupyterLab etc.)  Terminals and text editors almost universally do not launch 
maximized by default.  Therefore I think starting IDLE maximized would be an 
unnecessary departure from the common, expected UX of similar desktop apps.

I suggest closing this as "won't fix".

--
nosy: +taleinat

___
Python tracker 
<https://bugs.python.org/issue23937>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

See a second PR for the originally reported bug, GH-26404.

--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

It appears that this behavior is the intended behavior of Tk on macOS.  Given 
that tkinter is meant to be a relatively straightforward wrapping of Tcl/Tk, it 
seems to me that we too should consider this not to be a bug, and resolve this 
issue as "won't fix".

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

The Tcl/Tk devs have closed the issue I opened on their issue tracker as "not a 
bug", with the following comment:

"Because Tk on the Mac uses API's to draw buttons, some configuration options 
are set by the OS and not by Tk. This is documented in the button man page: "On 
Aqua/Mac OS X, some configuration options are ignored for the purpose of 
drawing of the widget because they would otherwise conflict with platform 
guidelines. The configure and cget subcommands can still manipulate the values, 
but do not cause any variation to the look of the widget. The options affected 
notably include -background and -relief." Closing this ticket as not a bug."

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +24997
pull_request: https://github.com/python/cpython/pull/26404

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Applying settings disables tab completion

2021-05-27 Thread Tal Einat


Change by Tal Einat :


--
versions: +Python 3.11, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Applying settings disables tab completion

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

Indeed, adding the events bound in EditorWindow.__init__ to RemoveKeybindings() 
and ApplyKeybindings(), so they are bound in the correct order, resolves this 
issue.

See PR GH-26403.

--

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Applying settings disables tab completion

2021-05-27 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +24996
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/26403

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:


New changeset abc4bd5db91c86b6b74289241378a13bd3a0a5e2 by Tal Einat in branch 
'main':
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400)
https://github.com/python/cpython/commit/abc4bd5db91c86b6b74289241378a13bd3a0a5e2


--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43654] IDLE: Applying settings disables tab completion

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

The original issue appears to be caused by <> also being bound to 
Tab, but <> only being bound using event_add() once in 
EditorWindow.__init__().  Therefore, RemoveKeybindings() does remove the 
binding for tab due to <>, but <> is not bound 
again by ApplyKeybindings().

That should mean that tab is still bound to <> and 
<>, as expected, but the order has changed: now <> 
was the last event added. We need <> to fire first.

Specifically, commenting out the line for <> from config.py 
causes this bug to no longer happen.

--
nosy: +taleinat

___
Python tracker 
<https://bugs.python.org/issue43654>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

Thanks for helping with this, E. Paine!

Unfortunately, no, adding activebackground='red' doesn't help, even directly in 
a wish shell.

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

To clarify, the above is regarding IDLE freezing on macOS after hitting tab to 
complete, with no completions window open, and with multiple completions 
possible.  That may not be identical to the issue originally reported here.  
Apologies if I've caused some confusion.

--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-26400.

--
stage: patch review -> needs patch

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +24993
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26400

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

I've confirmed that the acw.update() call is still required on Windows to avoid 
the completion list positioning bug, and that IDLE doesn't freeze as described 
in this issue on Windows with that call in place.

--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Change by Tal Einat :


--
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.10, Python 3.11

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

I can reproduce this consistently on macOS by running IDLE, typing "sys.ba" in 
the shell and pressing the tab key.

I've carefully narrowed this down to the call to acw.update() in 
AutoCompleteWindows.winconfig_event().  Removing that call makes everything 
work properly.

That call to acw.update() was added to address the bug reported in bpo-37849 
(see PR GH-15267).  That bug was reported on Windows, but apparently doesn't 
occur on macOS.  A quick test on Ubuntu 20.04 with that call removed also 
appears to not exhibit that bug.

Therefore, I propose making that call only on Windows.

Note that there is already another fragile call in the same method that is 
conditionally called only on Windows, so there is definitely precedent for such 
a solution.

--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41611] IDLE: problems with completions on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

> With 3.10.0b1 on Mac I am getting attribute completion freezes.  I had to 
> turn them off.  I am tempted to disable completions until there is a Mac IDLE 
> developer to dig into issues like this.

Confirmed. This may be a separate issue.

I have a macOS machine to develop with an will look into this.

--

___
Python tracker 
<https://bugs.python.org/issue41611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

I've created an issue about this on the Tcl/Tk issue tracker:

https://core.tcl-lang.org/tk/tktview/46274a117823fd65c6d98d38465b43165d0c4680

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-27 Thread Tal Einat


Tal Einat  added the comment:

Confirmed on macOS.

This bugs also affects the underlying Tcl/Tk, confirmed with 8.6.11.

To reproduce:

$ wish
% button .b -text START -bg red -fg white
.b
% pack .b

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44243] tkinter button colors on Mac

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

FWIW this also behaves as expected on Ubuntu 20.04 with both Python 3.8 and 
3.10.

--

___
Python tracker 
<https://bugs.python.org/issue44243>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

> Other bug reports and feature requests that matter to us don't appear to be 
> getting any traction:

I'll start going through those, and see if I can fix some of the bugs on that 
list.

A few notes:

> Need an option to run the install-certificates script

Are you suggesting that we add a way to do this directly from IDLE?

> Sometimes the Search Dialog window becomes unresponsive and there is no way 
> to clear it without turning IDLE off.

Is there an open issue about this? Details would be helpful.

> Several of these issues have only came-up in the past few years.  IDLE used 
> to be more stable than it is now.

This may be true, and at least partially due to a continuous need to fix things 
broken by various OS and Tcl/Tk changes.

> For mac users who have enabled tabs system-wide, opening a new window in IDLE 
> triggers a system log-out (amazing that this is even possible).  My 
> understanding is there isn't anything we can do about this, but it is a 
> really bad out-of-the-box user experience seconds after a fresh install of 
> Python.

This is a prime example of the above: macOS changes + Tcl/Tk issues with those 
mean we are often very limited in our ability to properly address such issues.  
FWIW we added a warning in the IDLE shell about running with that OS option 
enabled, see bpo-34864 and PR GH-10464.  I wasn't aware of such crashes; is 
there an issue about them?

> Being able to run pip from within IDLE would be a major win, especially for 
> Windows users who are foreign to the command-line and who often do have 
> Python on the PATH.

I agree!  This needs to be properly designed and would be far from trivial to 
implement and test.  If an issue about this exists or would be created, I'd be 
happy to help move it forward.

--

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

> Lastly, for live demos in presentations, it is desirable to have a clear 
> screen, free of distracting artifacts.  The sidebar is such an artifact -- 
> you would never see such a thing in a book or slide presentation.  Also, for 
> live demos, large fonts are necessary which means that screen space is at a 
> premium and the loss of horizontal space matters.

I am not sure I agree with the strength with which you state "you would never 
see such a thing in a book or slide presentation".  With Jupyter notebooks 
being very prevalent these days, samples very often include the non-code visual 
artifacts native to that format.  Arguably, the *prompts* are a distracting 
visual artifact; the ability to cut them out of screenshots from Jupyter 
notebooks thanks to the clearer separation of cells and their inputs and 
outputs is indeed a boon, and we could consider whether we can do something 
similar for IDLE.

As for lost vertical space, that is indeed at a premium for books and 
presentations.  However, ipython significantly increases the vertical spacing 
to the left of code inputs and non-stdout outputs compared to the standard 
Python REPL and IDLE.  And the sidebar adds 3.5 characters' width only for 
outputs, which can be avoided when it's truly crucial using the "Copy with 
prompts" feature.  Overall, considering the benefits, this seems like a 
relatively minor drawback.

--

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

> Another desirable feature is the ability to cut and paste snippets into 
> docstrings.  This is essential not just for doctest, but even for untested 
> examples in docstrings.
> Those examples, need to be recognizable to humans as interactive sessions 
> with outputs clearly distinguished from inputs.  When I tried out the new 
> sidebar in prep for a class, it was impossible to include the ps1 prompts in 
> a cut and paste selection.  They had to be manually typed back in.

This is no longer the case.  In a quick followup PR, which has been merged for 
some time now, we added a context-menu option "Copy with prompts" which results 
in code samples directly usable for doctests and code samples.

--

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

For a wider context, besides the default REPL, I also consider two other 
leading REPLs: ipython and Jupyter notebooks.  They both also have clear 
separation of outputs from inputs, though in different ways than the standard 
REPL.


ipython retains similar behavior to the standard REPL in this regard, replacing 
the '>>>' prompts with "In [1]:", "In [2]:" etc.  It also prefixes outputs of 
statements with e.g. "Out[2]:", but not outputs written to stdout.  And it has 
additional vertical spacing between commands.

Here is a short example session:

Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: if True:
   ...: print('Foo')
   ...: 
Foo

In [2]: beatles = ['john', 'paul', 'ringo', 'george']

In [3]: [name.capitalize() for name in beatles]
Out[3]: ['John', 'Paul', 'Ringo', 'George']


Jupyter notebooks are a different beast since their interface is browser-based 
rather than terminal-based, and they take more advantage of non-text graphical 
elements than IDLE's shell.  Inputs are done in "cells", which may contain 
multiple statements, and each cell its own output.  These cells are clearly 
visually separate from each other.  I've attached a screenshot of a similar 
Python 3 session in a Jupyter notebook for comparison.


Indeed, both the ipython REPL and Jupyter notebooks go further than the default 
REPL in differentiating outputs from inputs, using different methods.

--
Added file: https://bugs.python.org/file50066/Jupyter Notebook Example 
Session.png

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-26 Thread Tal Einat


Tal Einat  added the comment:

> For teaching purposes in live demos, it is essential to have a clear visual 
> distinction between the inputs and outputs:
>
> >>> beatles = ['john', 'paul', 'ringo', 'george']
> >>> [name.capitalize() for name in beatles]
> ['John', 'Paul', 'Ringo', 'George']
> >>> [name for name in beatles if 'n' in name]
> ['john', 'ringo']

Thanks for bringing this up. Lack of clear separation of inputs and outputs 
could be considered a drawback of putting prompts in a sidebar. 

Considering that the prompts *are not part of the code*, I do believe 
separating them more clearly is a benefit.  To support this, consider that in 
Jupyter notebooks, the prompts are also placed in a graphically-separated area 
to the left of both input and output "cells".

Also, do note that IDLE colors outputs differently from inputs, which helps 
differentiate them from inputs very clearly IMO.  Therefore, the examples in 
messages posted here are lacking in this regard.  For context, I'm attaching an 
image with screenshots before and after the change to use a sidebar.

Also, consider that previously, separation of outputs from inputs was not great 
for multi-line statements, as indentation was inconsistent and more vertical 
space was used:

>>> if True:
print('Foo')
else:
print('Bar')


Foo


I think that moving prompts into a sidebar is an improvement in this regard:

>>>| if True:
...|print('Foo')
...| else:
...|print('Bar')
...| 
   | Foo


Taking these three points together, I the sidebar clearly improves the 
separation of prompts from actual code, and the differentiation of outputs from 
inputs does not seem much worse, and is arguably overall better.

--
Added file: https://bugs.python.org/file50065/IDLE shell befoe and after 
sidebar.png

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-25 Thread Tal Einat


Tal Einat  added the comment:

IMO this can be closed, so I'm closing this.  (Terry is welcome to reopen this 
if needed.)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Tal Einat


Tal Einat  added the comment:

> It is partially an IDLE issue. The code expects that indices in Python string 
> correspond indices in Tcl string, but this is not true in case of astral 
> characters which are encoded as 2 (or maybe even 4) characters in Tcl.

It's not just that - Tk's Text widget is the indexing in the line itself wrong. 
In the string from Terry's example, which has 11 characters in a line including 
three smiley emojis, the can be fetch using t.get('1.1'), t.get('1.2') etc. 
through t.get('1.11'). t.get('1.12') returns '\n' since it is at or after the 
end of the line. So, as far as indexing is concerned, each of those emoji 
characters is treated as a single character.

--

___
Python tracker 
<https://bugs.python.org/issue44217>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-23 Thread Tal Einat

Tal Einat  added the comment:

This is at least partly a tcl/tk issue.

Using Terry's last example, the Text widget reports that the length of the line 
is 14 (t.index('1.end') -> '1.14'), despite it only including 11 characters. It 
appears that each emoji character adds an extra character.

Minimal reproducer:

>>> t.delete('1.0', 'end')
>>> t.insert('1.0', 'a')
>>> t.index('1.end')
'1.1'
>>> t.delete('1.0', 'end')
>>> t.insert('1.0', '')
>>> t.index('1.end')
'1.2'


The same happens when using tcl/tk directly, so it's not a tkinter issue:

$ wish
% tk::text .t -width 40 -height 5  -wrap none -yscrollcommand ".ys set" 
-xscrollcommand ".xs set"
.t
% ttk::scrollbar .ys -orient vertical -command ".t yview"
.ys
% ttk::scrollbar .xs -orient horizontal -command ".t xview".t
extra characters after close-quote
% ttk::scrollbar .xs -orient horizontal -command ".t xview"
.xs
% .t insert end "a"
% grid .t -column 0 -row 0 -sticky nwes
% grid .t -column 0 -row 0 -sticky nwes
% grid .ys -column 1 -row 0 -sticky ns
% grid columnconfigure . 0 -weight 1
% grid rowconfigure . 0 -weight 1
% .t delete 1.0 end  
% .t insert end ""  
% .t index 1.end
1.2
% .t get 1.0


--

___
Python tracker 
<https://bugs.python.org/issue44217>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44163] IDLE ValueError in HyperParser

2021-05-20 Thread Tal Einat


Tal Einat  added the comment:

I took a look but can't see any obvious bugs there. ISTM that's a rather 
harmless edge case. I can't think of anything to do with this except to close 
for now, and reopen if this pops up again.


Thinking a few steps forward, to make sense of such issues, it would be greatly 
beneficial to get a full stack dump rather than just a traceback. Perhaps we 
should add something of the sort to IDLE, ideally something which works even 
when not running from the command line?

--

___
Python tracker 
<https://bugs.python.org/issue44163>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Tal Einat


Tal Einat  added the comment:

After thinking about this a bit more, it seems to me that using an atexit 
handler is definitely worth pursuing, but not for 3.10.0.

I'm in favor of merging the existing PR as an immediate fix for IDLE, and 
following up with a general solution for tkinter using atexit, which should 
also include some tests so that we can see that it works on our CI and 
buildbots.

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Tal Einat


Tal Einat  added the comment:

> Tcl_Finalize can be called more than once, says the tcl doc.

I take that to mean that when calling Tcl_Finalize more than once, the second 
and following calls will do nothing rather than crash the process, corrupt 
memory etc.

The Tcl docs are quite clear that Tcl is no longer usable after calling 
Tcl_Finalize.  Therefore, E. Paine's latest comment appears to be correct in 
the sense that we can't call Tcl_Finalize when cleaning up a tkinter.Tk 
instance.  The same goes for Tcl_FinalizeThread.

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Tal Einat


Tal Einat  added the comment:

Wow, I'm very surprised! Simply uncommenting that works perfectly on Ubuntu 
20.04 and Windows 10.

I'll make a new PR...

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Tal Einat


Tal Einat  added the comment:

> What if register Tcl_Finalize as an atexit callback?

Precisely that was tried a long time ago (2002?) and decided against, as can be 
seen by the comment left behind at the end of _tkinter.c:

#if 0
/* This was not a good idea; through  bindings,
   Tcl_Finalize() may invoke Python code but at that point the
   interpreter and thread state have already been destroyed! */
Py_AtExit(Tcl_Finalize);
#endif

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-16 Thread Tal Einat


Change by Tal Einat :


--
versions: +Python 3.11 -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-16 Thread Tal Einat


Tal Einat  added the comment:

> Can we backport?  The change to _tkinter, not directly exposed in tkinter, 
> could be considered an enhancement, but is necessary to fix what I consider a 
> real bug in tkinter, and hence in IDLE.

I'm +1 for backporting the latest PR.  It only adds the clearly internal and 
undocumented _tkinter.finalize_tcl(), which is only used by IDLE.

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-16 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +24796
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26163

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-16 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-26163.

--
stage: patch review -> needs patch

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-16 Thread Tal Einat


Tal Einat  added the comment:

Okay, so it appears that a generic solution for tkinter is non-trivial, as it 
is not clear when to call Tcl_Finalize() or Tcl_FinalizeThread().

However, giving tkinter apps the ability to call those when appropriate is 
possible.  Exposing a thin wrapper around Tcl_Finalize in _tkinter, and making 
IDLE call that when exiting, resolves the clipboard preservation issue.

For some reason, calling Tcl_Finalize causes a memory segmentation issue for me 
on Ubuntu 20.04.  However, calling Tcl_FinalizeThread also resolves the 
clipboard issue without causing problems.  On Windows 10, calling either 
function works.

--

___
Python tracker 
<https://bugs.python.org/issue40452>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-15 Thread Tal Einat


Tal Einat  added the comment:

> And what you need is just to not pass to the wrapped function arguments which 
> were not passed to wrapper. *args and **kwargs do not contain arguments which 
> were not passed.

It's common for wrapper functions to mirror the defaults of the wrapped 
functions and pass those along... A quick search brings up an example from 
dataclasses where sentinel values are passed as arguments to a wrapped 
callable[1].

I concede that issues with pickling such values are very unlikely. I stumbled 
upon such an issue once and it was difficult to debug, but that was a very 
unusual circumstance.

Still, it's a bit surprising that we have public facing values in stdlib 
modules which don't behave as one would expect with regard to pickling. This is 
why I created this 

It seems that I should have marked this as "enhancement" rather than the 
default of "behavior", though, since I meant this to be an improvement on the 
current situation, rather then assert the current situation is "broken".

[1] 
https://github.com/python/cpython/blob/c10c2ec7a0e06975e8010c56c9c3270f8ea322ec/Lib/dataclasses.py#L346

--
type: behavior -> enhancement
versions:  -Python 3.10

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-14 Thread Tal Einat


Tal Einat  added the comment:

> I do not understand the problem with pickling sentinel values used as default 
> values for function parameters. Could you please show an example?

A category of relevant uses I can think of is when wrapping a function and 
storing the parameters it was called with for some later use. Some examples of 
this are logging, caching and RPC.

Specifically for RPC, using pickle to serialize/deserialize the parameters and 
then call the function with them seems reasonable. RPyC[1] does this in some 
cases, though I haven't yet checked how it handles these kinds of sentinel 
objects specifically.

I'll try to find a good concrete example.

[1] https://rpyc.readthedocs.io/

--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-14 Thread Tal Einat


Tal Einat  added the comment:

> This needs a good deal more discussion before sweeping through the code and 
> change a long standing Python idiom that has stood the test of time.

I agree this should be discussed, which is why I created this issue about it, 
as place for that discussion to take place. This is also being discussed on 
python-dev.

The examples I've mentioned are both rather new, and they have implemented 
sentinel values using three different methods, with those in dataclasses even 
being inconsistent among themselves. I fail to see how this can be considered 
"chang[ing] a long standing Python idiom that has stood the test of time".

> You "recently noticing this" doesn't mean that it is wrong.

I find this wording makes things unnecessarily personal and negative. Let's 
discuss things based on technical merit.

--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Tal Einat


Tal Einat  added the comment:

... and they can be given excellent reprs by using a meta-class:

class Sentinel(type):
@classmethod
def __prepare__(cls, name, bases, **kwds):
d = super().__prepare__(name, bases, **kwds)
def __new__(cls_, *args, **kwargs):
raise TypeError(
f'{cls_!r} is a sentinel and cannot be instantiated')
d.update(__new__=__new__)
return d

def __repr__(cls):
return f'{cls.__module__}.{cls.__qualname__}'


class MISSING(metaclass=Sentinel): pass


This also has another nice benefit:

>>> type(MISSING)


--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Tal Einat


Tal Einat  added the comment:

Alternatively, sentinels can simply be classes:

class Sentinel:
def __new__(cls, *args, **kwargs):
raise TypeError(f'{cls.__qualname__} cannot be instantiated')

class MISSING(Sentinel):
pass

--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Tal Einat


Tal Einat  added the comment:

Here is what I suggest working with sentinels would look like:


>>> from dataclasses import MISSING
>>> MISSING
dataclasses.MISSING
>>> M2 = pickle.loads(pickle.dumps(MISSING))
>>> M2
dataclasses.MISSING
>>> M2 is MISSING
True


Here's an implementation which ensures a single instance is used, even 
considering multi-threading and pickling, which sets a nice repr according to 
the module and class name:


try:
from threading import Lock
except ImportError:
class Lock:
def __enter__(self):
pass
def __exit__(self, exc_type, exc_value, traceback):
pass


class Sentinel:
_instance = None
_lock = Lock()
def __new__(cls):
if cls._instance is None:
with cls._lock:
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
def __repr__(self):
*path_parts, classname = self.__class__.__qualname__.split('.')
return '.'.join([self.__class__.__module__, *path_parts, 
classname.removeprefix('_')])


class _MISSING(Sentinel):
pass
MISSING = _MISSING()

--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Tal Einat


Tal Einat  added the comment:

Additional examples of such sentinel values in the stdlib are those in the 
dataclasses module, e.g. dataclasses.MISSING.

--

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Tal Einat


New submission from Tal Einat :

I recently noticed that some functions use sentinel values to differentiate 
between not having been passed any value vs. None. One example of this is 
traceback.print_exception(), hence I'm adding Irit to the nosy list.

However, using e.g. `sentinel = object()` or a single instance of a dedicated 
class/type can break when combined with pickling (see examples below).

Since these sentinel are usually compared using the `is` operator, having more 
than a single instance will break things, sometimes in very confusing ways.

I suggest ensuring that a single instance is always used, probably by using a 
class with a __new__() method making sure to always return a single instance.


>>> sentinel = object()
>>> sentinel2 = pickle.loads(pickle.dumps(sentinel))
>>> sentinel is sentinel2
False
>>> sentinel

>>> sentinel2



>>> class A:
... pass
... 
>>> a = A()
>>> a2 = pickle.loads(pickle.dumps(a))
>>> a is a2
False
>>> a
<__main__.A object at 0x7fd00a9972f0>
>>> a2
<__main__.A object at 0x7fd009599450>

--
components: Library (Lib)
messages: 393580
nosy: iritkatriel, taleinat
priority: normal
severity: normal
status: open
title: make function parameter sentinel value true singletons
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44123>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21261] Teach IDLE to Autocomplete dictionary keys

2021-05-11 Thread Tal Einat


Change by Tal Einat :


--
keywords:  -easy, patch

___
Python tracker 
<https://bugs.python.org/issue21261>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21261] Teach IDLE to Autocomplete dictionary keys

2021-05-11 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch

___
Python tracker 
<https://bugs.python.org/issue21261>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21261] Teach IDLE to Autocomplete dictionary keys

2021-05-11 Thread Tal Einat


Tal Einat  added the comment:

Note that I've created a new version of the latest PR, with support for dict 
keys of type bytes removed.

--

___
Python tracker 
<https://bugs.python.org/issue21261>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21261] Teach IDLE to Autocomplete dictionary keys

2021-05-11 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +24684
pull_request: https://github.com/python/cpython/pull/26039

___
Python tracker 
<https://bugs.python.org/issue21261>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


Change by Tal Einat :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue44084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


Tal Einat  added the comment:

Thanks Dominic, it seems that you're absolutely right!

--

___
Python tracker 
<https://bugs.python.org/issue44084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Tal Einat


New submission from Tal Einat :

Beginning in Python 3.10, `match`, `case` and `_` are "soft keywords", i.e. 
they are considered keywords only in specific parts of the syntax.

However, they cannot be tagged with a :keyword:`...` role in our docs.

This appears to be due to not appearing in the list of keywords in the Python 
lexer in Pygments, which is used by Sphinx.

I've opened an issue on the Pygments repo about this:
https://github.com/pygments/pygments/issues/1797

--
assignee: docs@python
components: Documentation
messages: 393301
nosy: docs@python, taleinat
priority: normal
severity: normal
status: open
title: Can't mark match, case, _ as keywords in docs
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-06 Thread Tal Einat


Tal Einat  added the comment:

Upon reading Terry's previous comments here more carefully, it's clear that he 
will be adding an option to switch between this mode and an alternate mode with 
prompts on separate lines in the main text widget. The latter will be much more 
similar to the traditional mode.

--

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37903] IDLE Shell sidebar.

2021-05-06 Thread Tal Einat


Tal Einat  added the comment:

> Is it possible to add a Settings option under the General tab to switch 
> between the sidebar mode and traditional mode?

Raymond, that should be possible, and possibly rather easily. I'll take a look 
at adding this option.

--

___
Python tracker 
<https://bugs.python.org/issue37903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-03 Thread Tal Einat


Tal Einat  added the comment:

I've created a PR (GH-25851) with a rather quick, working implementation.

This includes some tests but I haven't thoroughly tested it yet.

If anyone can take a look and give feedback on the approach, that would be 
great.

--

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-03 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +24534
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/25851

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-03 Thread Tal Einat


Tal Einat  added the comment:

> A related request is to to syntax highlight field expressions in f strings.

Related, but separate, and IMO not quite as urgent.

I can commit to working on this issue (soft keywords), but I'll have to see 
where things stand once this is finished before moving on to f-strings.

--

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-03 Thread Tal Einat


Tal Einat  added the comment:

I think it is rather crucial to have this with the 3.10 release. I'll try to 
get this working ASAP.

I agree that a simple "good enough" solution could be a good start, but "_" 
will likely need special handling.

--

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44010] IDLE: highlight soft keywords

2021-05-03 Thread Tal Einat


Tal Einat  added the comment:

Terry, Elisha, does one of you intend to work on this? If not, I'd be willing 
to.

--

___
Python tracker 
<https://bugs.python.org/issue44010>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >