[issue41859] Uncaught ValueError

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I presume that at some point you got a completion box.  It disappeared with 
this traceback and when >>> appeared, you continued.  What python binary? 
3.8.5?  3.8.6? My diagnosis so far.

__call__ is a method in CallWrapper.  The wrapped func is multicall.handler.  
The exception was caught in the
except: self.widget._report_exception()
clause of __call__, but it should never have been raised.

keyrelease_event catches internal errors.  If the insert cursor is not where 
IDLE expects, because "# we didn't catch an event which moved the insert", IDLE 
just closes box rather than trying to recover.  I presume that this should 
never happen.  But when it did, a ValueError was raised for the reason given.  
In this error state, multicall.event_delete makes an invalid assumption.

The simple and immediate fix would be to catch the very rare delete failure.  A 
better and harder fix would be to catch the uncaught insert-moving event. For 
this, it would have been nice if keyrelease displayed a message identifying the 
released key with an email request.  I should  try to reproduce the failure 
(including on Mac) by trying every key (or type of key) that might possibly 
move the cursor.

--

___
Python tracker 

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



[issue41860] random.choices() raises "int too large" error while random.randint does not

2020-09-24 Thread Heng Sun


New submission from Heng Sun :

If I run this one line of code:

random.choices(range(2**100), k=5)

I would get error:

OverflowError: Python int too large to convert to C ssize_t

But I can run equivalent line to achieve this without error:

[random.randint(0, 2**100-1) for j in range(5)]

With the understanding of the issue coming from len(), ref 
https://bugs.python.org/issue12159, I still think random.choices() should be 
able to handle large integers.

--
components: Library (Lib)
messages: 377480
nosy: mathtester
priority: normal
severity: normal
status: open
title: random.choices() raises "int too large" error while random.randint does 
not
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue41859] Uncaught ValueError

2020-09-24 Thread Raymond Hettinger


New submission from Raymond Hettinger :

I found this in today's long running shell session.  The trigger event isn't 
known.

Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py",
 line 1885, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py",
 line 176, in handler
r = l[i](event)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py",
 line 430, in keyrelease_event
self.hide_window()
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py",
 line 447, in hide_window
self.widget.event_delete(HIDE_VIRTUAL_EVENT_NAME, seq)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py",
 line 392, in event_delete
triplets.remove(triplet)
ValueError: list.remove(x): x not in list

--
assignee: terry.reedy
components: IDLE
messages: 377479
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: Uncaught ValueError
versions: Python 3.9

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Timings depend on multiple factors, including implementation (cpython versus 
pypy versus cython, etc) and complexity of the keep/discard decision. I said in 
the proposed text that a listcomp may be faster.  I think that sufficient; 
anyone who cares can test their specific case.

I like the simple ad easy 'slice replacement = iterator' form because it 
illustrates to me that we have done something right with Python's design.

--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Try running some timings.  I suspect the genexp/iterator versions run more 
slowly.  The speed of the slice replacement relies on knowing the size of the 
input.

--

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On Windows, tk Scale['from'] is no longer rounded, matching ttk.Scale.  More 
details and conditional fix on the PR.

--
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue41850] inspect.py: access block stack

2020-09-24 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe the block stack is only for catching exceptions. Loops do not 
interact with the block stack. Only SETUP_FINALLY adds to the block stack:

https://docs.python.org/3/library/dis.html#opcode-SETUP_FINALLY

Meanwhile, loops and conditionals and the like are compiled into goto-like 
jumps.

There may be some existing solution, but I'm not sure what. Maybe look at the 
traceback or ast modules.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue41858] Fix incomplete line on optparse documentation

2020-09-24 Thread Emmanuel Arias


Change by Emmanuel Arias :


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

___
Python tracker 

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



[issue41858] Fix incomplete line on optparse documentation

2020-09-24 Thread Emmanuel Arias


New submission from Emmanuel Arias :

This line seems to be incomplete. This fix come from the translation
to spanish of @fjsevilla-dev on 
https://github.com/python/python-docs-es/pull/758/file.
reading the proposal for the translate has sense add `the next lines`.

--
assignee: docs@python
components: Documentation
messages: 377474
nosy: docs@python, eamanu
priority: normal
severity: normal
status: open
title: Fix incomplete line on optparse documentation
versions: Python 3.10

___
Python tracker 

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



[issue41857] Document timeout arguments to poll() in select module

2020-09-24 Thread Zane Bitter


Change by Zane Bitter :


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

___
Python tracker 

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



[issue41857] Document timeout arguments to poll() in select module

2020-09-24 Thread Zane Bitter


New submission from Zane Bitter :

The select.poll.poll() and select.devpoll.poll() methods don't have their 
timeout arguments documented in their docstrings. In both cases the argument is 
in milliseconds, whereas the timeout arguments to select.kqueue.control() and 
select.epoll.poll() are in seconds, and are documented in the docstring.

--
assignee: docs@python
components: Documentation
messages: 377473
nosy: docs@python, zaneb
priority: normal
severity: normal
status: open
title: Document timeout arguments to poll() in select module
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The existing patch mostly changes '9' to '10', which cannot in itself cause the 
test failure.  There must be a change in widget behavior.  Either Serhiy or 
Mark Rosemen might do better at diagnosing the discrepancy and whether 
_tkinter.c, tkinter.__init__, or tkinter/.../test_widget.py should be changed.
--

PR branches on the main repository are discouraged.  It is just as easy and 
safer for another coredev to modify a fork branch.

--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

You are right; the replacement index I called 'j' is better buried as a C index 
or pointer within a slice replacement. In fact, a generator expression, if one 
has a keep expression, or a filter call, if one has filter function, work, 
without the intermediate list.   Both also incorporate the keep scan 
index/pointer in C.  I verified that this works by defining 3 functions.

def fc(n, keep):
mylist = list(range(n))
mylist[:] = [x for x in mylist if keep(x)]
return mylist

def fg(n, keep):
mylist = list(range(n))
mylist[:] = (x for x in mylist if keep(x))
return mylist

def fl(n, keep):
mylist = list(range(n))
mylist[:] = filter(keep, mylist)
return mylist

I added a second test expression.

print(fc(i, keep) == fg(i, keep) == fl(i, keep) == expect)

at the 3 obvious places in the test loop above.
---

In the existing question about removing duplicates, the existing all-hashable 
answer
   mylist = list(set(mylist))
could be replaced by
   mylist[:] = set(mylist)

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue41856] argparse: auto-generated synopsis omits REMAINDER argument

2020-09-24 Thread Reuben Thomas


Reuben Thomas  added the comment:

A workaround to help users for now is:

>>> parser.add_argument('args', metavar='...', nargs=argparse.REMAINDER)

as then at least the help entry corresponds to the synopsis:

positional arguments:
  command
  ...

And with a `help` string, this can be clarified further, e.g.:

>>> parser.add_argument('args', metavar='...', nargs=argparse.REMAINDER, 
>>> help='arguments to the command')

--

___
Python tracker 

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



[issue41856] argparse: auto-generated synopsis omits REMAINDER argument

2020-09-24 Thread Reuben Thomas


New submission from Reuben Thomas :

Consider the following example from the Python documentation:

>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--foo')
>>> parser.add_argument('command')
>>> parser.add_argument('args', nargs=argparse.REMAINDER)

Now show the help:

>>> parser.parse_args(['-h'])

This prints:

usage: PROG [-h] [--foo FOO] command ...

positional arguments:
  command
  args

Note that "args" is not shown in the synopsis. I suggest that the synopsis 
should instead say:

usage: PROG [-h] [--foo FOO] command args...

--
components: Library (Lib)
messages: 377469
nosy: rrt
priority: normal
severity: normal
status: open
title: argparse: auto-generated synopsis omits REMAINDER argument
versions: Python 3.8

___
Python tracker 

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



[issue24757] Installing Py on Windows: Need to restart or logout for path to be added

2020-09-24 Thread Eryk Sun


Eryk Sun  added the comment:

> We already update the current shell, so if you start a new 
> terminal/Powershell/cmd/etc. instance it should have the 
> updated variable. 

The installer broadcasts an "Environment" message to top-level windows. In 
practice, only Explorer listens for and reloads its environment for this window 
message. For most programs, a new instance has to be run from Explorer in order 
to get the updated environment. 

CMD and PowerShell don't own any windows, so they cannot get this message in 
principle. The console-session host process (conhost or openconsole) may own a 
top-level window if it wasn't allocated with CREATE_NO_WINDOW and wasn't 
created as a ConPTY server (e.g. under Windows Terminal). But the console 
doesn't have a console control event for this case (e.g. something like a 
hypothetical CTRL_ENVIRONMENT_EVENT) that it sends to client processes. It's 
assumed that console applications that need to interact with the desktop 
environment will create at least a hidden window.

Without the "Environment" message, it's still possible for the user to run a 
script that reloads the environment in place in CMD or PowerShell. The 
environment has to be loaded in four passes: system REG_SZ values, system 
REG_EXPAND_SZ values, user REG_SZ values, and user REG_EXPAND_SZ values. User 
values should always be able to depend on system values, and REG_EXPAND_SZ 
values should always be able to depend on REG_SZ values. This is the way WinAPI 
CreateEnvironmentBlock has always worked. When reloading PATH, this is an issue 
if a new machine PATH value depends on new/modified REG_SZ system variables or 
if a new user PATH value depends on new/modified system variables or 
new/modified REG_SZ user variables.

--

___
Python tracker 

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



[issue40813] Output SyntaxError is not defective

2020-09-24 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think it's true that the lineno is correct when compiling a string 
(Remi's string is just too short):

>>> try:
... compile('if __name__ == "__main__":\n   print("hello world"\n   x=5\n', 
'', 'exec')
... except SyntaxError as e:
... print("e.lineno=", e.lineno)
... print("e.offset=", e.offset)
... print("e.text=", e.text)
...
e.lineno= 3
e.offset= 4
e.text=x=5
>>>


Arguably the syntax error is on line 3. Line 2 can be complemented by a line 3 
that will make it valid.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-09-24 Thread Steve Dower


Steve Dower  added the comment:

(My PR is from a branch in the main repo, so if you want to just go in and fix 
it, feel free.)

--

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-09-24 Thread Steve Dower


Steve Dower  added the comment:

I did a build for Windows and put up the PR taking it in and there seems to be 
one (related) test failure:

==
FAIL: test_from (tkinter.test.test_tkinter.test_widgets.ScaleTest)
--
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\tkinter\test\test_tkinter\test_widgets.py", 
line 943, in test_from
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
  File "D:\a\cpython\cpython\lib\tkinter\test\widget_tests.py", line 106, in 
checkFloatParam
self.checkParam(widget, name, value, conv=conv, **kwargs)
  File "D:\a\cpython\cpython\lib\tkinter\test\widget_tests.py", line 63, in 
checkParam
self.assertEqual2(widget[name], expected, eq=eq)
  File "D:\a\cpython\cpython\lib\tkinter\test\widget_tests.py", line 47, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 14.9 != 15.0

Terry, any ideas?

--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> The usually recommended alternative is to make a new list of 
> things not deleted.  But one can do this in-place by writing
> the new list on top of the old by using a explicit second 
> index to move items just once.

I don't think we should send users down this path.  Better to stick with high 
level, easy-to-implement and performant suggestions:

"""
To edit a list in-place it is often simplest and fastest to replace the entire 
list:

   colors[:] = [color for color in colors if websafe(color)]

This makes a single pass through the list and efficiently builds a new list.  
The colors[:] then replaces the entire contents of the original list with the 
new list
"""

Besides being easy to get right, this is likely to be *much* faster than 
tracking two indicies to manipulate the array in-place.  Slice operations run 
at the speed of a C memcpy (plus the ref count changes) and don't involve 
creating and destroying integer objects for indexing.

--
nosy: +rhettinger

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-09-24 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +21445
pull_request: https://github.com/python/cpython/pull/22405

___
Python tracker 

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



[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-24 Thread Eryk Sun


Eryk Sun  added the comment:

> The biggest risk here is that we have to emulate GNU readline for 
> compatibility, which severely limits the data that can be passed 
> through, and also forces multiple encoding/decoding passes. 

I'm not suggesting to disable the console's line-input and echo-input modes and 
implement our own line editor. If people don't like the built-in line editor 
that the console provides, they can use pyreadline, which directly uses the 
console's low-level API via ctypes.

Here's an example of what I would like to just work by default in Python:

import sys
import win32console

def write_input(h, s):
 records = []
 for c in s:
 b = c.encode('utf-16le')
 for i in range(0, len(b), 2):
 r = win32console.PyINPUT_RECORDType(win32console.KEY_EVENT)
 r.KeyDown = True
 r.RepeatCount = 1
 r.Char = b[i:i+2].decode('utf-16le', 'surrogatepass')
 records.append(r)
 h.WriteConsoleInput(records)

def write_and_read_line(s):
if '\r' not in s:
s += '\r'
h = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE)
mode = h.GetConsoleMode()
h.SetConsoleMode(mode & ~win32console.ENABLE_ECHO_INPUT)
try:
write_input(h, s)
line = sys.stdin.readline()
finally:
h.SetConsoleMode(mode)
return line

>>> src_line = 'a' * 32765 + '\r'
>>> res_line = write_and_read_line(src_line)
>>> assert res_line == src_line.replace('\r', '\n')
Traceback (most recent call last):
  File "", line 1, in 
AssertionError
>>> len(res_line)
511
>>> res_line[:5], res_line[-5:]
('a', '\n')


Currently the ReadConsoleW buffer in read_console_w is capped at 512 (BUFSIZ) 
characters. With the console's processed-input mode enabled, it writes a 
trailing CRLF instead of the raw CR. So the user is limited to typing or 
pasting just 510 characters on a single line. 

I was only thinking to increase the default maximum size up to 32K in 
read_console_w -- removing the fixed BUFSIZ aspect of the implementation in 
favor of capping the buffer used at BUFMAX. In practice this also requires 
similar default increases for the BufferedReader size and TextIOWrapper chunk 
size.

--

___
Python tracker 

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



[issue41855] FastPath.zip_children can give duplicate results on Python 3.8

2020-09-24 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +21444
pull_request: https://github.com/python/cpython/pull/22404

___
Python tracker 

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



[issue41855] FastPath.zip_children can give duplicate results on Python 3.8

2020-09-24 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue41492] Fix signing description for Windows release builds

2020-09-24 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue40458] test_bad_getattr crashes on APPX test

2020-09-24 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue39041] Support GitHub Actions in CI

2020-09-24 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue41855] FastPath.zip_children can give duplicate results on Python 3.8

2020-09-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

The relevant commit is already present in importlib_metadata as 
[079ca1cb701a5f4aab0a9cb00b0782c7ea8fb70b](https://gitlab.com/python-devs/importlib_metadata/-/commit/079ca1cb701a5f4aab0a9cb00b0782c7ea8fb70b).

--
components: +Library (Lib)

___
Python tracker 

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



[issue41855] FastPath.zip_children can give duplicate results on Python 3.8

2020-09-24 Thread Jason R. Coombs


New submission from Jason R. Coombs :

Scott J. reports in an e-mail:

When upgrading to Python 3.8.2, we noticed two issues in
importlib.metadata which are not present in importlib_metadata.

1.  FastPath.zip_children() is very slow for large zips. Python 3.8.3
> already has a fix for this
> 
([[bug]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.python.org%2Fissue39667=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462361570=Msk47lScorCQpx5PHiKrpeYYzBLMR89HNZ7RwY7ch4c%3D=0),
> 
[[changelog]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.python.org%2F3%2Fwhatsnew%2Fchangelog.html%23id45=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462371564=CSPBVi5rPFSCovRZdd8WNbOQ4mxDycy%2FmjDhbty4OLk%3D=0)),
> which includes merging in importlib_metadata 1.5.0.

2.  FastPath.zip_children() can give duplicate results, causing
> duplicate results in entry_points(). This issue was reported in
> importlib_metadata in March
> 
([[link]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fpython-devs%2Fimportlib_metadata%2F-%2Fissues%2F117=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462371564=g5N0ew3WAOUfPJ5eL7oY0j9NIpXkh8HAkV%2FWD4UppX8%3D=0))
> and fixed in importlib_metadata 1.5.2
> 
([[changelog]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimportlib-metadata.readthedocs.io%2Fen%2Flatest%2Fchangelog.html%23v1-5-2=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462381558=UpnqBoyl%2FcGMkF%2BfFufredA0QGt31o5Qag3joQ%2FJhDs%3D=0)).

In June, importlib_metadata 1.6.1 (including the fix for \#2) was merged
into Python
([[bug]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.python.org%2Fissue39791%23msg370782=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462381558=i8Y8o5f3uBXPP8OU9I3PkKSHzS%2B3z4kcd%2FdH1l%2B9YI8%3D=0),
[[PR]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F20659=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462391552=Q5P3RuTNpctc4E93l2dqXRc1LYmw9XSnBb%2FaJbKTcMg%3D=0))
and backported to 3.9
([[PR]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F20661=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462391552=f%2BghmbplIsbmc9CFgoQX7vxc%2FZPLG2TkEgjMZtez71s%3D=0)).
However, the backport for Python 3.8 was **not** merged
([[PR]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F20662=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462391552=JTpQpeuzE%2BGvL%2FNccWcuu0vQWRKQbkBHLmzeNmWZMFc%3D=0)).
Jason said:

> Of course this can\'t backport to 3.8; importlib.resources.files
> doesn\'t exist there. No problem. Bug fixes will need to be backported
> specially if needed.

As far as I can tell, no version of importlib_metadata newer than 1.5.0
has ever been merged into Python 3.8, and so bug \#2 is still present
(tested in 3.8.6rc1). This seems like it falls under the \"bug fixes if
needed\" category. We just need to fix the duplicate entries, as
reported in importlib_metadata. This should be trivial. The diff in
python 3.9 is
[[here]{.ul}](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F20661%2Ffiles%23diff-499abe3a411df5cf55659b640ac3b2b4L411-R435=02%7C01%7Cbwarsaw%40linkedin.com%7C514c7c4d1eea417ed26908d86024cd43%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637365058462401547=qZXa9e13SVng5tkL3Im2s1Gc2OSLOKlqiiDKBTqkxoI%3D=0).

--
assignee: jaraco
messages: 377461
nosy: barry, jaraco
priority: normal
severity: normal
status: open
title: FastPath.zip_children can give duplicate results on Python 3.8
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue41854] argparse.add_mutually_exclusive_group fails for optional positional arguments

2020-09-24 Thread Reuben Thomas


New submission from Reuben Thomas :

The following code:

group = parser.add_mutually_exclusive_group()
group.add_argument('--install-only', action='store_true',
help='just install the program, do not run it')
group.add_argument('args', metavar='ARGUMENT', nargs='*', default=None,
help='arguments to PROGRAM')

gives the following error:

group.add_argument('args', metavar='ARGUMENT', nargs='*',
  File "/usr/lib/python3.8/argparse.py", line 1398, in add_argument
return self._add_action(action)
  File "/usr/lib/python3.8/argparse.py", line 1621, in _add_action
raise ValueError(msg)
ValueError: mutually exclusive arguments must be optional

But the 'args' argument *is* optional, as there can be 0 of them.

--
components: Library (Lib)
messages: 377460
nosy: rrt
priority: normal
severity: normal
status: open
title: argparse.add_mutually_exclusive_group fails for optional positional 
arguments
versions: Python 3.8

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In the last few months, there has been an increase in bpo issues mis-tagged 
IDLE.  Today's example: #41774

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

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread miss-islington


miss-islington  added the comment:


New changeset 18e59f587b86297d4fc99765be10d92a717d4775 by Miss Islington (bot) 
in branch '3.8':
bpo-41775: Make 'IDLE Shell' the shell title  (GH-22399)
https://github.com/python/cpython/commit/18e59f587b86297d4fc99765be10d92a717d4775


--

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread miss-islington


miss-islington  added the comment:


New changeset 4080f12b17cee36732758912dc4346ec9361 by Miss Islington (bot) 
in branch '3.9':
bpo-41775: Make 'IDLE Shell' the shell title  (GH-22399)
https://github.com/python/cpython/commit/4080f12b17cee36732758912dc4346ec9361


--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I modeled the new entry on the previous one.  The code and its test.

def fr(n, remove):
mylist = list(range(n))
for i in range(len(mylist)-1, -1, -1):
if remove(mylist[i]):
del mylist[i]
return mylist

def ff(n, keep):
   mylist = list(range(n))
   j = 0
   for i, item in enumerate(mylist): 
   if keep(item):
   mylist[j] = item
   j += 1
   del mylist[j:]
   return mylist

for i in range(9):

expect = list(range(0, i, 2))
def remove(n): return n % 2
def keep(n): return n % 2 == 0
print(fr(i, remove) == ff(i, keep) == expect)

expect = list(range(i//2))
def remove(n): return n >= i//2
def keep(n): return n < i//2
print(fr(i, remove) == ff(i, keep) == expect)

expect = list(range(i//2, i))
def remove(n): return n < i//2
def keep(n): return n >= i//2
print(fr(i, remove) == ff(i, keep) == expect)

# all True

--

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 05cc881cbcf5d73a312568c78c7149eae3195072 by Terry Jan Reedy in 
branch 'master':
bpo-41775: Make 'IDLE Shell' the shell title  (#22399)
https://github.com/python/cpython/commit/05cc881cbcf5d73a312568c78c7149eae3195072


--

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +21440
pull_request: https://github.com/python/cpython/pull/22400

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21441
pull_request: https://github.com/python/cpython/pull/22401

___
Python tracker 

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



[issue41775] IDLE: change Shell window title

2020-09-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue41853] Windows docs for command line install don't mention /log option

2020-09-24 Thread Steve Dower


Steve Dower  added the comment:

Sounds good to me.

Pull requests welcome :)

--

___
Python tracker 

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



[issue24757] Installing Py on Windows: Need to restart or logout for path to be added

2020-09-24 Thread Steve Dower


Steve Dower  added the comment:

Sorry, but we don't have any way to update the current terminal process. We 
already update the current shell, so if you start a new 
terminal/Powershell/cmd/etc. instance it should have the updated variable. 

The workaround you posted is fine. Directly adding the new install to the 
current PATH is also okay.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue41852] Inconsistent errors for JSON-encoding NaNs with allow_nan=False

2020-09-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41853] Windows docs for command line install don't mention /log option

2020-09-24 Thread Forrest Shields


New submission from Forrest Shields :

Section "3.1.3. Installing Without UI" of the Windows documentation at 
https://docs.python.org/3/using/windows.html#installing-without-ui does not 
mention the existence of the `/log` option.

However, this option is detailed when the Windows installer is executed with a 
`/?` argument. (see attached image).

The documentation (for all versions that contained the logging option) should 
be updated.

The help dialog also defines the `/simple` option. This appears to overlap with 
a "name=value" option called SimpleInstall. If both options are still active, 
then the docs should also mention `/simple`.  If this option is deprecated in 
favor of the "name=value" version, then the help dialog needs to be updated.

Finally, I think the docs would be much more readable if the slash options were 
in a table similar to the "name=value" options.

--
assignee: docs@python
components: Documentation, Windows
files: Python-3.8.5-for-WIndows--Setup-Help.png
messages: 377452
nosy: docs@python, forrestshields2, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: Windows docs for command line install don't mention /log option
type: enhancement
versions: Python 3.10, Python 3.8, Python 3.9
Added file: 
https://bugs.python.org/file49473/Python-3.8.5-for-WIndows--Setup-Help.png

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ae462297c08515f2c0dacf77b04816504142ba3e by Thomas Grainger in 
branch '3.8':
[3.8] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from 
pymain_run_module (GH-21956) (#22398)
https://github.com/python/cpython/commit/ae462297c08515f2c0dacf77b04816504142ba3e


--

___
Python tracker 

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



[issue41852] Inconsistent errors for JSON-encoding NaNs with allow_nan=False

2020-09-24 Thread Ben Kurtovic


New submission from Ben Kurtovic :

json.dump vs. json.dumps have inconsistent error messages when encoding NaN 
with allow_nan=False:

>>> json.dumps(float('nan'), allow_nan=False)
ValueError: Out of range float values are not JSON compliant
>>> json.dump(float('nan'), sys.stdout, allow_nan=False)
ValueError: Out of range float values are not JSON compliant: nan

json.dump's error includes the value (which is useful); json.dumps's does not.

json.dumps uses this C implementation: 
https://github.com/python/cpython/blob/d67de0a30d76c6a28056bae22fd7d13f2e111b77/Modules/_json.c#L1340
json.dump uses this Python implementation: 
https://github.com/python/cpython/blob/d67de0a30d76c6a28056bae22fd7d13f2e111b77/Lib/json/encoder.py#L223

(Separately, is it expected that only one uses the C implementation? This seems 
it could have unexpected performance implications - without testing, I would've 
expected json.dump to take the "faster" path since it doesn't need to hold the 
entire encoded string in memory.)

--
components: Extension Modules, Library (Lib)
messages: 377450
nosy: earwig
priority: normal
severity: normal
status: open
title: Inconsistent errors for JSON-encoding NaNs with allow_nan=False
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue24757] Installing Py on Windows: Need to restart or logout for path to be added

2020-09-24 Thread Forrest Shields


Forrest Shields  added the comment:

As of 3.8.5 the current shell's PATH is outdated after a commandline 
system-wide installation.  This makes it very difficult to do a scripted 
install of Python followed by the `python` or `pip` commands, as they will not 
be found. In addition to modifying the PATH in the system scope, the PATH 
should also be modified for the current process (shell).

Here is the WORKAROUND I created and am currently using:

1. Perform the commandline system-wide installation from an Administrative 
PowerShell prompt.
2. After the installation (but before using `python` or `pip`) rebuild the PATH 
environment variable for the current process from the concatenation of the PATH 
environment variables from the System and User scopes (this is how Windows 
builds the PATH) by using this code:
```
[Environment]::SetEnvironmentVariable('PATH', 
[Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + 
[Environment]::GetEnvironmentVariable('PATH', 'User'), 'Process')
```

--
components: +Installation
nosy: +forrestshields2
versions: +Python 3.8

___
Python tracker 

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



[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-24 Thread Steve Dower


Steve Dower  added the comment:

I'm in favour of this change in principle, but would want to look at the PR 
closely.

The biggest risk here is that we have to emulate GNU readline for 
compatibility, which severely limits the data that can be passed through, and 
also forces multiple encoding/decoding passes. It would be nice to be able to 
bypass this in cases where nobody is using it, though since so many host 
applications use hooks there'll likely only be a benefit to people at the plain 
console...

--

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Thomas Grainger


Change by Thomas Grainger :


--
pull_requests: +21438
pull_request: https://github.com/python/cpython/pull/22398

___
Python tracker 

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



[issue41838] Value error is showing in docset python (class)

2020-09-24 Thread Eric V. Smith


Change by Eric V. Smith :


--
status: open -> pending

___
Python tracker 

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



[issue41739] test_logging: threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2)

2020-09-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ca8d46dd422e5aa10f444796d93faec5a8cbc1e0 by Łukasz Langa in 
branch '3.9':
[3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from 
pymain_run_module (GH-21956) (#22397)
https://github.com/python/cpython/commit/ca8d46dd422e5aa10f444796d93faec5a8cbc1e0


--

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 5.0 -> 6.0
pull_requests: +21437
pull_request: https://github.com/python/cpython/pull/22397

___
Python tracker 

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



[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.10

___
Python tracker 

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



[issue41851] tkinter: add font neg and equal methods

2020-09-24 Thread E. Paine


New submission from E. Paine :

I think it would be helpful to add these methods to the tkinter font class.

Starting with the equal method, I have found it very useful to be able to 
compare tkinter fonts based on their value rather than just name. I used this, 
for example, in #28694 to ensure the -font attribute had been changed correctly 
(though there I compared each of the attributes explicitly rather than using 
`.actual()` as I have in this patch).

The neg method, I think, would be very useful to allow easy conversion between 
points and pixels. For example:

points = Font(size=16)
pixels = -points

--
components: Tkinter
messages: 377446
nosy: epaine, gpolo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: tkinter: add font neg and equal methods
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue41851] tkinter: add font neg and equal methods

2020-09-24 Thread E. Paine


Change by E. Paine :


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

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Irit Katriel


Irit Katriel  added the comment:

On windows 10, master:

> python.bat --version
Running Release|Win32 interpreter...
Python 3.10.0a0

>python.bat x.py
Running Release|Win32 interpreter...
SyntaxError: too many statically nested blocks

That's when x.py has the nested for loops without else. The error goes away if 
I add the else.

--

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Mark Shannon


Mark Shannon  added the comment:

iritkatriel

What error do you see and on what version?

--

___
Python tracker 

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



[issue28694] tkinter interface to fontchooser

2020-09-24 Thread E. Paine

E. Paine  added the comment:

I have started looking at Mark's wrapper (though I have not been able to
​spend as much time on it as I would like). It's mostly small changes
​that I have made (in no particular order):
- TkFontchooserFontChanged event calls 'command' (to be behave like an
'apply' button - this only occurs on platforms that set font due to user
​actions, otherwise we don't know what font has been selected)
- a cget method (which getitem now forwards to)
- 'show' takes 'configure' kwargs
- allow instantiation without kwargs before root creation*
- 'ismodal' decorated as property
- 'compatible' module attribute set at import (`tkinter.TkVersion >= 8.6`)
- winfo_toplevel used to ensure parent is a window (see comment at bottom)
- TkFontchooserVisibility has a visibilitycommand kwarg**

* In most use cases, the user will only want a single instance of the
Chooser class through the entire application run and then just change
change the parent as required. The idea here is that we can instantiate
the class at import and then lazy-load the parent so the user can call
something like `tkinter.fontchooser.chooser.show()`. This is the reason
​I decided to decorate 'ismodal' as a property, rather than having it as
​a variable set on class load.

** I would prefer to keep the user from binding virtual events to the
parent themselves and instead intend to provide a kwarg for a command to
be called when this event is generated (I think binding to the parent is
needlessly complicated, especially when we call winfo_toplevel before
​passing to Tk anyway, so I thought it was either this or we provide the
​user with a 'bind' method for the class). Between this proposal and
​TkFontchooserFontChanged calling 'command', this would eliminate all
need for the user to bind the events themselves (hence, they should not
​be included in the docs).

I haven't yet properly tested it (just focusing on changing the
​user-facing api), however I think what Mark has got so far is very close
​to what we should submit as a patch (my ideas are attached as a diff of
​Mark's file). The above are just QOL changes to *hopefully* make it
​easier for the user, rather than another rewrite of the wrapper.

> Documentation would be key

Definitely! I think this is quite possibly the hardest part of the patch
(after deciding what is the 'cleanest' api for the user) because we need
​to ensure the docs are detailed and precise while being accessible to
​those who don't know Tk (and hence won't be digging through the Tk man -
​in which case, as helpful as the "Notable differences from underlying Tk
​API" is internally, it should not be part of the docs).

> I assume the official wrapper needs checks to ensure fontchooser is
> available (i.e. 8.6 or greater). If not, should the wrapper just error out?

Personally, I would just leave the wrapper without any checks for
version validity. All the official installers use 8.6 and there are very
​few distros that don't provide 8.6 as their default Tk package (most
​notably CentOS 6 & 7). We should provide a module-level attribute that
​checks the Tk version for the user (this is the 'compatible' attribute
​included in the diff) but I don't think we should do anything beyond
​this (it is hence up to the user to ensure they are on a compatible
​system). Applications like IDLE, which try to be compatible with older
​versions of Tk, should provide their own fallback interface rather than
​building such an interface into tkinter.


I am not the biggest fan of the current implementation of ismodal as
​this is based purely on Mark's testing of just 3 windowing systems
​(Windows, X11 & MacOS - my point is about the limited number not that I
​doubt Mark's testing!). While I think the BSDs also use X11, we are
​effectively declaring that there are no other windowing systems (on an
​OS CPython supports) where fontchooser is modal (which I very reluctant
​to do). At the same time, though, I don't have a clue how else it would
​be implemented in a user-friendly way (I can think of a couple of ways
​but all of them involve showing the fontchooser temporarily).

My suggestion is, therefore, to raise a NotImplementedError if the
​current windowing system is not one of 'win32', 'x11' or 'aqua'
​(because, of these, we know that only win32 is modal - the docs would
​have to note this limited availability).


Addressing a couple of Mark's points in an email he sent me:

> the -parent option doesn’t need to be a toplevel
In my limited testing (on X11), I found that the virtual events were not
​called unless this was true (or at least it appeared so...).

> there’s some argument to be made that because the bind lets you
​> trigger multiple callbacks it may promote looser coupling
While I see the point, I think the same could be said of Tk having
​-command rather than a virtual binding. I also think we should pick one
​of either kwargs or virtual events and then stick to that to avoid an
​inconsistent api (in my diff, I 

[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-24 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue41850] inspect.py: access block stack

2020-09-24 Thread Gregoire Chalony


New submission from Gregoire Chalony :

The inspect module doesn't currently expose any way to access the block stack 
at runtime.
Would that be possible?

Aked on StackOverflow here: 
https://stackoverflow.com/questions/63187845/cpython-access-loop-depth-level-block-stack.

--
messages: 377442
nosy: gchalony
priority: normal
severity: normal
status: open
title: inspect.py: access block stack
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Irit Katriel


Irit Katriel  added the comment:

Another oddity:

This gives the error:
for x in '1':
 for x in '2':
  for x in '3':
   for x in '4':
for x in '5':
 for x in '6':
  for x in '8':
   for x in '9':
for x in '10':
 for x in '11':
  for x in '12':
   for x in '13':
for x in '14':
 for x in '15':
  for x in '16':
   for x in '17':
for x in '18':
 for x in '19':
  for x in '20':
   for x in '21':
for x in '22':
 pass

but this doesn't:

for x in '1':
 for x in '2':
  for x in '3':
   for x in '4':
for x in '5':
 for x in '6':
  for x in '8':
   for x in '9':
for x in '10':
 for x in '11':
  for x in '12':
   for x in '13':
for x in '14':
 for x in '15':
  for x in '16':
   for x in '17':
for x in '18':
 for x in '19':
  for x in '20':
   for x in '21':
pass
   else:
for x in '22':
 pass

--

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Irit Katriel


Irit Katriel  added the comment:

Unlike the 22 nested while,

if 1:
  if 2:
...
if 22:
pass

doesn't error. Is that correct?

--

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Humm, my supposition was not absolutely correct. The cause is that the compiler 
and the interpreter use the stack of size CO_MAXBLOCKS for different things. 
The interpreter pushes a thing for the "except" clause, while the compiler does 
not do it.

--

___
Python tracker 

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



[issue40608] PY3.8 GC segfault (Py_TRASHCAN_SAFE_BEGIN/END are not backwards compatible)

2020-09-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think that we should try to land PR 12607 first.

--

___
Python tracker 

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



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2020-09-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a bug. Compiler explicitly checks if the number of nested "try" blocks 
does not exceed the limit of CO_MAXBLOCKS, but it does not count implicit "try" 
blocks inserted when your assign an exception in the "except" clause.

try:
...
except Exception as e:
...

is actually translated to

try:
...
except Exception:
try:
e = ...
...
finally:
e = None
del e

So we have double number of nested "try" blocks.

--
nosy: +Mark.Shannon, serhiy.storchaka
type: behavior -> crash
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-24 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
nosy: +BTaskaya
nosy_count: 6.0 -> 7.0
pull_requests: +21434
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22394

___
Python tracker 

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



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +benjamin.peterson, gvanrossum, pablogsal, serhiy.storchaka

___
Python tracker 

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



[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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