[issue44952] list need to filter again because the continue empty str value?

2021-08-18 Thread py_ok

py_ok <1979239...@qq.com> added the comment:

Yes,I remember that my error in Java,like you say it`s skiped

--原始邮件--
发件人: "Python tracker"https://bugs.python.org/issue44952;;
___

--

___
Python tracker 

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



[issue44952] list need to filter again because the continue empty str value?

2021-08-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

To understand why your code doesn't work, run this:

items = ['a', '', 'b', '', 'c', '', 'd', '', 'e', '']

print(len(items))

for index, item in enumerate(items):
print(index, repr(item), items)
if item == '':
items.remove('')


When you remove an item, all the remaining items slide over one position, into 
the slot that has already been inspected. That means that they get skipped.

--
resolution:  -> not a bug

___
Python tracker 

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



[issue44952] list need to filter again because the continue empty str value?

2021-08-18 Thread py_ok


py_ok <1979239...@qq.com> added the comment:

Thanks,Very timely resolve my problem

--
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



[issue44952] list need to filter again because the continue empty str value?

2021-08-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Not a bug. Use this instead:

def rv(items):
for item in items[:]:  # iterate over a copy
if not (item.isspace() or item == ''):
items.remove(item)
return items


Or the same as above, as a list comprehension, no need to make a copy:

items = [item for item in items if not (item.isspace() or item == '')]

--
nosy: +steven.daprano

___
Python tracker 

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



[issue44921] dict subclassing is slow

2021-08-18 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue44952] list need to filter again because the continue empty str value?

2021-08-18 Thread py_ok


New submission from py_ok <1979239...@qq.com>:

I`m poor in english.please run my code,Thanks.

def rv(list):
for i in list:
#print(type(i))
#print(i.__len__())
if (i.isspace() or i=='' or len(i)==0):
list.remove(i)
return list
list=['k', '', '', '', 'v', '', 'e', '', '', '', '73', '', 'p', '76', '']
print(rv(list))#['k', 'v', 'e', '73', '', 'p', '76', '']
The result still have empty str,I need to filter again.The reason is more empty 
val is linked.is a bug?or some reason?

--
components: Build
messages: 399882
nosy: py_ok
priority: normal
severity: normal
status: open
title: list need to filter again because the continue empty str value?
type: performance
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



[issue44944] Addition of _heappush_max method to complete the max heap implementation in Python's heapq module

2021-08-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> duplicate
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



[issue44951] selector.EpollSelector: EPOLLEXCLUSIVE, round 2

2021-08-18 Thread David Gilman


David Gilman  added the comment:

I also played with making another whole subclass that has it on by default, see 
this package https://github.com/dgilman/selector-epoll-exclusive

That class could have EPOLLEXCLUSIVE on by default but could raise 
NotImplemented if you try and modify() it. Putting it in as a second class 
means you can also drop it into existing code unmodified, something that will 
play very nicely with all existing users of selector.

--

___
Python tracker 

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



[issue44951] selector.EpollSelector: EPOLLEXCLUSIVE, round 2

2021-08-18 Thread David Gilman


Change by David Gilman :


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

___
Python tracker 

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



[issue44951] selector.EpollSelector: EPOLLEXCLUSIVE, round 2

2021-08-18 Thread David Gilman


New submission from David Gilman :

Note that this is a different approach from the one taken in 
https://bugs.python.org/issue35517 although the issue is still the same.

I've written a patch that allows users of selector.EpollSelector to enable 
EPOLLEXCLUSIVE on their file descriptors. This PR adds a setter and read only 
property to only the EpollSelector class instead of trying to expand the entire 
selector API like the other patch. The other discussion mentioned that there 
are some useful flags that could be passed down like this one. If other useful 
behavioral flags emerged in the future I think they should get their own API 
similar to how I've done it here. However, the other flags available so far for 
epoll are not useful for the selector module: EPOLLONESHOT and EPOLLET are 
incompatible with the design of the selector API and EPOLLWAKEUP is only 
marginally useful, not even getting exported into the select module after 
nearly a decade (Linux 3.5 was released in 2012).

My API uses a getter/method instead of a read/write property because my 
understanding is that property access shouldn't raise exceptions, but if that 
doesn't matter here, it could be a read/write property.

Justification:

First, this is a useful flag that improves performance of epoll under even 
moderate load. I was going to turn it on by default in this patch but 
unfortunately Linux prevents you from doing epoll_mod() on anything that has 
EPOLLEXCLUSIVE set on it, breaking the python-level API. With this patch if you 
try to modify() after EPOLLEXCLUSIVE is set you'll get an EINVAL but I think 
the trade-off here is worth it. You don't enable EPOLLEXCLUSIVE on accident and 
you're reading the manpage for EPOLLEXCLUSIVE where this exact behavior is 
mentioned before turning anything on, right? And of course the Python docs also 
warn you about modify().

Second, the thundering herd problem solved by EPOLLEXCLUSIVE is somewhat of a 
sore spot for Python's PR. In the past year two widely disseminated articles 
have brought up this issue. This PR isn't going to be a silver bullet however 
it can make a huge impact in gunicorn, the 3rd party library mentioned in both 
articles. Gunicorn is a popular WSGI web server and its gthread worker (not the 
default but the one most often used in production) directly uses the selector 
module from the standard library. Honestly, it's pretty cool that they were 
able to make such efficient use of a standard library module like this - how 
far we've come from the days of asynchat! There is nothing in gunicorn's 
threaded worker that calls modify() so there would be no API breakage there.

Gunicorn thundering herd articles:
https://blog.clubhouse.com/reining-in-the-thundering-herd-with-django-and-gunicorn/
https://rachelbythebay.com/w/2020/03/07/costly/

--
components: Library (Lib)
messages: 399880
nosy: David.Gilman
priority: normal
severity: normal
status: open
title: selector.EpollSelector: EPOLLEXCLUSIVE, round 2

___
Python tracker 

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



[issue44942] Add number pad enter bind to TK's simpleDialog

2021-08-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This proposal is not a bug fix.

In my testing on Windows today, Ryan is correct in saying (on the PR) that kp 
return key normally acts is same as normal return key.  True regardless of 
Numlock.  This is *also true*, at least on Windows, of instances of 
SimpleDialog, Dialog, and _QueryDialog.  I tested _QueryDialog via IDLE's use 
of askinteger.  I believe the patch has no effect on Windows.

I have the impression that the Windows behavior in not standard on *nix, where 
tcl/tk was first implemented.  I would not change behavior on *nix with 
Serhiy's okay, and I would not expect it.

IDLE adds KP_Enter bindings in a couple of its own dialogs with defaults.  I 
don't remember if I inherited these, but I believe that there was a 
pre-existing policy of trying to make IDLE acts the same across systems, which 
I have adopted also.  But a *nix-only tkinter app should not have Windows 
behavior imposed on it. 

I cannot test on my no-numberpad Macbook Air.

--
nosy:  -gpolo
type: behavior -> enhancement

___
Python tracker 

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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-18 Thread Jack DeVries


Jack DeVries  added the comment:

@terry.reedy ok, a PR to restore the docs with the new link is open.

--

___
Python tracker 

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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-18 Thread Jack DeVries


Change by Jack DeVries :


--
pull_requests: +26283
pull_request: https://github.com/python/cpython/pull/27818

___
Python tracker 

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



[issue44941] Add check_methods function to standard library

2021-08-18 Thread Finn Mason


Finn Mason  added the comment:

I strongly feel that `check_methods` shouldn't be in collections.abc, even 
though that's where it's originally found, because it's not related 
specifically to collections but to ABCs and classes in general. I would prefer 
for it to be implemented in `abc` or similar.

I'm reverting to the original title until a module is decided on.

I'd be happy to do the implementation and pull request once approval is given 
and a module is decided on.

--
title: Add check_methods function to collections.abc in standard library -> Add 
check_methods function to standard library

___
Python tracker 

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



[issue44950] Math

2021-08-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This is not a bug, see the tutorial page here: 
https://docs.python.org/3.9/tutorial/floatingpoint.html

Also, in the future, it's best to report bugs by thoroughly describing the 
actual/expected behavior in text and copy/pasting code, rather than just 
posting an image, otherwise it looks like spam from the outside. It also helps 
screen readers for people with difficulty seeing.

--
nosy: +Dennis Sweeney
resolution:  -> not a bug
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



[issue44079] [sqlite3] remove superfluous statement weak ref list from connection object

2021-08-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
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



[issue44079] [sqlite3] remove superfluous statement weak ref list from connection object

2021-08-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 243b6c3b8fd3144450c477d99f01e31e7c3ebc0f by Erlend Egeberg 
Aasland in branch 'main':
bpo-44079: Strip superfluous statement cache from sqlite3.Connection (GH-25998)
https://github.com/python/cpython/commit/243b6c3b8fd3144450c477d99f01e31e7c3ebc0f


--
nosy: +pablogsal
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



[issue44950] Math

2021-08-18 Thread Hamish


New submission from Hamish :

Error shown in image

--
components: Interpreter Core
files: unknowasdasdasdn.png
messages: 399874
nosy: hamish555
priority: normal
severity: normal
status: open
title: Math
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50226/unknowasdasdasdn.png

___
Python tracker 

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



[issue42491] Tkinter wait_visibility hanging when used in thread

2021-08-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

tcl/tk can be compiled without or with thread support.  For 8.5, the default 
was without.  For 8.6, the default is with.  The Windows and macOS installers 
include 8.6 compiled with the default.  I have not previously heard of problems 
with thread when it is so compiled.  Both of you, what tcl versions?  how 
compiled?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Fixing the link now, given that it is possible, and someone someday writing a 
new doc to replace it are different issues.  This issue is about the link.

--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a by Łukasz Langa in 
branch '3.9':
[3.9] bpo-44947: Refine the syntax error for trailing commas in import 
statements (GH-27814) (GH-27817)
https://github.com/python/cpython/commit/4e4d35d3325fb1e05dad43bd1ec73f14c3c5dc0a


--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Łukasz Langa

Change by Łukasz Langa :


--
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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-18 Thread Thomas Grainger


Thomas Grainger  added the comment:

Depends on the redirect type they create. If it's temporary we should keep
the same URL, if it's permanent or otherwise has bookmark updating
semantics we should update the URL to follow the redirect

On Wed, 18 Aug 2021, 21:40 Jack DeVries,  wrote:

>
> Jack DeVries  added the comment:
>
> All right, consider the needle in the haystack officially found. This page
> has the same content as the missing page:
>
> https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html
>
> Thank you @buhtz for opening an issue with Mozilla; they are eventually
> going to deploy a redirect to the link above from the old link:
> https://github.com/mdn/content/issues/8036
>
> So, we could go ahead and insert the link above which contains the same
> content as before. Or, we can keep the call open for a new document. What
> does everyone think?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +26282
pull_request: https://github.com/python/cpython/pull/27817

___
Python tracker 

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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-18 Thread Jack DeVries


Jack DeVries  added the comment:

All right, consider the needle in the haystack officially found. This page has 
the same content as the missing page:

https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html

Thank you @buhtz for opening an issue with Mozilla; they are eventually going 
to deploy a redirect to the link above from the old link:
https://github.com/mdn/content/issues/8036

So, we could go ahead and insert the link above which contains the same content 
as before. Or, we can keep the call open for a new document. What does everyone 
think?

--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread miss-islington


miss-islington  added the comment:


New changeset 846a10fc45ef83b41d1b1b568a9ee8012f37c8c2 by Miss Islington (bot) 
in branch '3.10':
bpo-44947: Refine the syntax error for trailing commas in import statements 
(GH-27814)
https://github.com/python/cpython/commit/846a10fc45ef83b41d1b1b568a9ee8012f37c8c2


--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset b2f68b190035540872072ac1d2349e7745e85596 by Pablo Galindo Salgado 
in branch 'main':
bpo-44947: Refine the syntax error for trailing commas in import statements 
(GH-27814)
https://github.com/python/cpython/commit/b2f68b190035540872072ac1d2349e7745e85596


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44874] Deprecate Py_TRASHCAN_SAFE_BEGIN/END

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 31ee985db86c1339d00bd0d3cc1712019460670a by Irit Katriel in 
branch 'main':
bpo-44874: deprecate Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END (GH-27693)
https://github.com/python/cpython/commit/31ee985db86c1339d00bd0d3cc1712019460670a


--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26280
pull_request: https://github.com/python/cpython/pull/27815

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset a3a4d20d6798aa2975428d51f3a4f890248810cb by Yurii Karabas in 
branch 'main':
bpo-44524: Fix cryptic TypeError message when trying to subclass special forms 
in `typing` (GH-27710)
https://github.com/python/cpython/commit/a3a4d20d6798aa2975428d51f3a4f890248810cb


--

___
Python tracker 

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



[issue44815] asyncio.gather no DeprecationWarning if task are passed

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Sam! ✨  ✨

--
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



[issue44929] Some RegexFlag cannot be printed in the repr

2021-08-18 Thread Ethan Furman


Ethan Furman  added the comment:

`_name_` is only None if the entire enum value is outside any named member and 
`_boundary_` is `KEEP` -- so

class Example(Flag, boundary=KEEP):
first = auto()
second = auto()
third = auto()

>>> Example(0)
module.Example(0)

>>> Example(8)
module.Example(8)

No need to backport.

--
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



[issue44815] asyncio.gather no DeprecationWarning if task are passed

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset b2779b2aa16acb3fd1297ccfe2fe5aaa007f74ae by Sam Bull in branch 
'3.9':
[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep() (GH-27569)
https://github.com/python/cpython/commit/b2779b2aa16acb3fd1297ccfe2fe5aaa007f74ae


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44943] Integrate PyHyphen into the textwrap module?

2021-08-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Many years ago I write highly optimized hyphenation module (as a part of 
OrnamentBook project 
https://sourceforge.net/projects/pybookreader/files/OrnamentBook/). I could 
contribute the code to the stdlib. But the problem is that the algorithm 
depends on language specific data files. I am not sure that we are ready to 
include these files in the stdlib. And how are we going to handle requests for 
support of new languages and how to validate contributed data files for unknown 
new languages?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The problem is not the keyword, is that we are parsing correctly until the 
"and" and we find the comma there. It happens with anything that invalidates 
more items:

>>> from math import sin, cos, $ tan
  File "", line 1
from math import sin, cos, $ tan
   ^
SyntaxError: trailing comma not allowed without surrounding parentheses

--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Andre Roberge


Andre Roberge  added the comment:

Based on what I just read on 
https://github.com/davidhalter/parso/blob/master/parso/python/issue_list.txt
I gather that this exception is only raised in the context of an import 
statement with a trailing comma (usually followed by nothing).

--

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 6fb62b42f4db56ed5efe0ca4c1059049276c1083 by Victor Stinner in 
branch 'main':
bpo-44949: Fix test_readline auto history tests (#27813)
https://github.com/python/cpython/commit/6fb62b42f4db56ed5efe0ca4c1059049276c1083


--

___
Python tracker 

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



[issue44173] Stored (uncompressed) ZipExtFile in zipfile can be seekable at lower cost

2021-08-18 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith

___
Python tracker 

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



[issue44895] refleak test failure in test_exceptions

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

You can also play with the clear() method of frame objects and 
traceback.clear_frames() (which expects a traceback object).

--

___
Python tracker 

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



[issue44895] refleak test failure in test_exceptions

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

> test leaked [-4, 4, -4] references, sum=-4

If I disable the GC, the script no longer detects "leaks". Same using a GC 
threshold of 800.

Using a GC threshold between 100 and 700, I reproduce the [-4, 4, -4] 
references leak.

Funny bug.

--

___
Python tracker 

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



[issue44895] refleak test failure in test_exceptions

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

Irit: do you still reproduce the issue using gc.disable()? Or you can try 
different values to call gc.set_threshold(). You may also try different values 
in ns.huntrleaks, like: ns.huntrleaks = (3, 20, 'tt_out.py'). With 20 
iterations, do you still reproduce the leak?

To make the issue more likely, you can change check_rc_deltas() in 
Lib/test/libregrtest/refleak.py. Try:

def check_rc_deltas(deltas):
return any(delta >= 1 for delta in deltas)

With this change, the script stops immediately:

test leaked [-4, 4, -4] references, sum=-4
test leaked [-4, 4, -4] memory blocks, sum=-4

Using 20 iterations, I get:

test leaked [-4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 
4] references, sum=0
test leaked [-4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 
4] memory blocks, sum=0

--

___
Python tracker 

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



[issue44943] Integrate PyHyphen into the textwrap module?

2021-08-18 Thread Elsie Hupp


Elsie Hupp  added the comment:

I mainly suggested PyHyphen because (at a fairly superficial glance) it has 
been around for over a decade, and it extends an existing module rather than 
adding a new one. To be fair, `textwrap` itself is relatively niche, and it's 
my understanding that it's also a relatively recent addition to the standard 
library.

I can repost this this to the mailing list, though I'll probably do some more 
digging first.

--

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

I ran the test manually on the buildbot worker. Sometimes, the test process 
gets the EIO error even before getting the 2 newline bytes (b"\r\n"). I wrote 
PR 27813 to simply not expect the newline character.

Adding flush=True to the print("History length:", 
readline.get_current_history_length()) call in the Python script doesn't fix 
the issue.

--

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue44926] typing.get_type_hints() raises for type aliases with forward references

2021-08-18 Thread Ken Jin


Ken Jin  added the comment:

> Ken Jin, can you guide Maximilian towards a successful doc update PR?

It seems that Maximilian has already made some contributions to CPython, so I'm 
sure he's somewhat familiar with our workflow :). Nonetheless, @Maximilian if 
you need any help, please do ping me, I'll be happy to.

We could add a ..note: here 
https://docs.python.org/3/library/typing.html#typing.get_type_hints. The 
document is at 
https://github.com/python/cpython/blob/main/Doc/library/typing.rst. The Python 
docs style guide is at https://devguide.python.org/documenting/#style-guide.

Thanks Max for your interest in improving CPython!

PS: I've changed the affected versions to the ones we still bugfix (3.9 and up).

--
versions: +Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

I failed to reproduce the issue on Fedora 34 (readline-8.1-2.fc34.i686).

$ ./python -m test test_readline -m test_auto_history_disabled -j40 -F
(...)
0:19:35 load avg: 42.40 [10785] test_readline passed
0:19:35 load avg: 42.40 [10786] test_readline passed
0:19:35 load avg: 42.40 [10787] test_readline passed
^C
Test suite interrupted by signal SIGINT.
10787 tests OK.
Total duration: 19 min 36 sec

$ ./python -m test test_readline -j40 -F
(...)
0:03:30 load avg: 41.07 [1330] test_readline passed
0:03:31 load avg: 41.07 [1331] test_readline passed
^C
1331 tests OK.
Total duration: 3 min 31 sec
Tests result: INTERRUPTED

--

___
Python tracker 

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



[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-18 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue44926] typing.get_type_hints() raises for type aliases with forward references

2021-08-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

We could mention this in the docs for one or more of the following:

- type aliases (old or new syntax)
- forward references
- get_type_hints()

Ken Jin, can you guide Maximilian towards a successful doc update PR?

--

___
Python tracker 

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



[issue44942] Add number pad enter bind to TK's simpleDialog

2021-08-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sorry, CLA is signed, but I'd like Terry Reedy to have a peek.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_readline: test_auto_history_disabled() fails on aarch64 RHEL8 
Refleaks 3.9, 3.10 and 3.x -> test_readline: test_auto_history_disabled() fails 
randomly on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

___
Python tracker 

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



[issue44949] test_readline: test_auto_history_disabled() fails on aarch64 RHEL8 Refleaks 3.9, 3.10 and 3.x

2021-08-18 Thread STINNER Victor


New submission from STINNER Victor :

test_readline fails randomly on aarc64 RHEL8 buildbots (3.9, 3.10 and 3.x).

In some builds, test_readline fails but then pass when re-run in verbose mode. 
Example:
https://buildbot.python.org/all/#/builders/41/builds/148
---
0:02:56 load avg: 2.79 Re-running test_readline in verbose mode (matching: 
test_auto_history_disabled)
test_auto_history_disabled (test.test_readline.TestReadline) ... ok
---


aarch64 RHEL8 Refleaks 3.9:
https://buildbot.python.org/all/#/builders/247/builds/107

test.pythoninfo:

readline._READLINE_LIBRARY_VERSION: 7.0
readline._READLINE_RUNTIME_VERSION: 0x700
readline._READLINE_VERSION: 0x700

Tests:

0:33:57 load avg: 0.93 Re-running test_readline in verbose mode (matching: 
test_auto_history_disabled)
beginning 6 repetitions
123456
readline version: 0x700
readline runtime version: 0x700
readline library version: '7.0'
use libedit emulation? False
test test_readline failed
test_auto_history_disabled (test.test_readline.TestReadline) ... FAIL
==
FAIL: test_auto_history_disabled (test.test_readline.TestReadline)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.9.cstratak-RHEL8-aarch64.refleak/build/Lib/test/test_readline.py",
 line 154, in test_auto_history_disabled
self.assertIn(b"History length: 0\r\n", output)
AssertionError: b'History length: 0\r\n' not found in bytearray(b'dummy 
input\r\ndummy input\r\nHistory length: 0')
--

--
components: Tests
messages: 399848
nosy: erlendaasland, lukasz.langa, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_readline: test_auto_history_disabled() fails on aarch64 RHEL8 
Refleaks 3.9, 3.10 and 3.x
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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

PyStructSequence_InitType2() is not compatible with subinterpreters: it uses 
static types. Moreover, it allocates tp_members memory which is not released 
when the type is destroyed. But I'm not sure that the type is ever destroyed, 
since this API is designed for static types.

--

___
Python tracker 

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



[issue44944] Addition of _heappush_max method to complete the max heap implementation in Python's heapq module

2021-08-18 Thread Eric V. Smith


New submission from Eric V. Smith :

This has been discussed and rejected in at least issue 27295 and issue 42240, 
and probably others.

--
nosy: +eric.smith

___
Python tracker 

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



[issue44948] DeprecationWarning: Using ioctl() method

2021-08-18 Thread Thomas Trummer


New submission from Thomas Trummer :

DeprecationWarning: Using ioctl() method on sockets returned from 
get_extra_info('socket') will be prohibited in asyncio 3.9. Please report your 
use case to bugs.python.org.

Use case:

def connection_made(self, transport: asyncio.BaseTransport) -> None:
sock = transport.get_extra_info('socket')  # type: socket.socket
sock.ioctl(SIO_UDP_CONNRESET, False)

Releated: https://bugs.python.org/issue44743

--
components: Windows, asyncio
messages: 399845
nosy: Thomas Trummer, asvetlov, paul.moore, steve.dower, tim.golden, 
yselivanov, zach.ware
priority: normal
severity: normal
status: open
title: DeprecationWarning: Using ioctl() method
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



[issue44743] asyncio DatagramProtocol stops calling callbacks after OSError

2021-08-18 Thread Thomas Trummer


Change by Thomas Trummer :


--
nosy: +Thomas Trummer

___
Python tracker 

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



[issue44937] test_regrest: test_tools_script_run_tests() failed on GHA Windows x64

2021-08-18 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj

___
Python tracker 

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



[issue43805] multiprocessing.Queue hangs when process on other side dies

2021-08-18 Thread Jon Clucas


Change by Jon Clucas :


--
nosy: +shnizzedy

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2021-08-18 Thread Jon Clucas


Change by Jon Clucas :


--
nosy: +shnizzedy

___
Python tracker 

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



[issue44942] Add number pad enter bind to TK's simpleDialog

2021-08-18 Thread Guido van Rossum

Guido van Rossum  added the comment:

It’s fine. We now need the PR author to sign the CLA.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue44942] Add number pad enter bind to TK's simpleDialog

2021-08-18 Thread Electro707


Change by Electro707 :


--
nosy: +Electro707

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Hummm, interesting.

I wonder if this only happens with keywords or if this can be reproduced with 
other constructs

--

___
Python tracker 

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



[issue44943] Integrate PyHyphen into the textwrap module?

2021-08-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thank you for the suggestion.

Hyphenation seems like a niche requirement to me, probably too niche and with 
too many design decisions to include it in the stdlib. It's also not clear to 
my why PyHyphen would be the best option for this, as opposed to the other 
hyphenation libraries on PyPI. You'll need to address both of these issues as 
part of any proposal.

I suggest you bring this up on the python-ideas mailing list in order to get a 
broader discussion.

--
components: +Library (Lib)
nosy: +eric.smith

___
Python tracker 

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



[issue44944] Addition of _heappush_max method to complete the max heap implementation in Python's heapq module

2021-08-18 Thread Yatharth Mathur


Change by Yatharth Mathur :


--
components: +Library (Lib)

___
Python tracker 

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



[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ebe7e6d86cf8f54d449d49866698d7f4c700cc7c by Miss Islington (bot) 
in branch '3.9':
bpo-44852: Support filtering over warnings without a set message (GH-27793) 
(GH-27810)
https://github.com/python/cpython/commit/ebe7e6d86cf8f54d449d49866698d7f4c700cc7c


--

___
Python tracker 

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



[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

2021-08-18 Thread miss-islington


miss-islington  added the comment:


New changeset d1c0e4413dd544270df1f5b8a145fd4370cb759b by Miss Islington (bot) 
in branch '3.10':
bpo-44852: Support filtering over warnings without a set message (GH-27793)
https://github.com/python/cpython/commit/d1c0e4413dd544270df1f5b8a145fd4370cb759b


--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Andre Roberge


Andre Roberge  added the comment:

This message is not new to Python 3.10 as it is also shown with Python 3.9.5.

>>> from math import sin, cos, and tan
  File "", line 1
from math import sin, cos, and tan
   ^
SyntaxError: trailing comma not allowed without surrounding parentheses

--
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



[issue44946] Integer operations are inefficient for "medium" integers.

2021-08-18 Thread Mark Shannon


Mark Shannon  added the comment:

Just changes to longobject.c.

There are still various minor inefficiencies in testing to see whether an int 
is a medium value, and then throwing away size information before creating 
result objects.

I'm not expecting this to make much difference, but every little helps.

--

___
Python tracker 

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



[issue44947] SyntaxError: trailing comma not allowed ... misleading

2021-08-18 Thread Andre Roberge


New submission from Andre Roberge :

Consider the following four slightly different examples:

Python 3.10.0rc1 ...

>>> from math import sin and cos
  File "", line 1
from math import sin and cos
 ^^^
SyntaxError: invalid syntax


>>> from math import sin, cos, and tan
  File "", line 1
from math import sin, cos, and tan
   ^^^
SyntaxError: trailing comma not allowed without surrounding parentheses


>>> from math import (sin, cos,) and tan
  File "", line 1
from math import (sin, cos,) and tan
 ^^^
SyntaxError: invalid syntax


>>> from math import sin, cos and tan
  File "", line 1
from math import sin, cos and tan
  ^^^
SyntaxError: invalid syntax


In all four cases, the keyword 'and' is correctly identified as causing the 
error. In the second case, the message given may suggest that adding 
parentheses is all that is needed to correct the problem; however, that is 
"obviously" not the case as shown in the third case.

**Perhaps** when a _keyword_ like 'and' is identified as a problem, a generally 
better message would be something like

SyntaxError: the keyword 'and' is not allowed here

leaving out all guesses like 'surrounding by parentheses', "meaning == instead 
of =", 'perhaps forgot a comma', etc., which are sometimes added by Python 
3.10+ ?

I am fully and painfully aware that attempting to provide helpful and accurate 
error message is challenging...

--
components: Parser
messages: 399837
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: SyntaxError: trailing comma not allowed ... misleading
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



[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

2021-08-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26277
pull_request: https://github.com/python/cpython/pull/27810

___
Python tracker 

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



[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

2021-08-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +26276
pull_request: https://github.com/python/cpython/pull/27809

___
Python tracker 

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



[issue44852] Add ability to wholesale silence DeprecationWarnings while running the test suite

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 8cf07d3db3eed02b43350a5f9dbf68f1c839ea82 by Łukasz Langa in 
branch 'main':
bpo-44852: Support filtering over warnings without a set message (GH-27793)
https://github.com/python/cpython/commit/8cf07d3db3eed02b43350a5f9dbf68f1c839ea82


--

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Serhiy, what do you suggest we should do then?

--

___
Python tracker 

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



[issue44946] Integer operations are inefficient for "medium" integers.

2021-08-18 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +vstinner

___
Python tracker 

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



[issue44946] Integer operations are inefficient for "medium" integers.

2021-08-18 Thread Mark Dickinson


Mark Dickinson  added the comment:

See also #21955, #10044, and 
https://github.com/python/cpython/blob/3240bc62f4e0afa09964f3afc845697f0a0806b9/Python/ceval.c#L1986-L1991

--

___
Python tracker 

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



[issue44946] Integer operations are inefficient for "medium" integers.

2021-08-18 Thread Mark Dickinson


Mark Dickinson  added the comment:

We already special-case medium integers in the Objects/longobject.c code, in 
various places. For example for addition, here:

https://github.com/python/cpython/blob/3240bc62f4e0afa09964f3afc845697f0a0806b9/Objects/longobject.c#L3070-L3072

Are you proposing further changes in longobject.c, or some other mechanism?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue44946] Integer operations are inefficient for "medium" integers.

2021-08-18 Thread Mark Shannon


New submission from Mark Shannon :

"Medium" integers are those with a single internal digit or zero.
Medium integers are integers in the range -2**30 to +2**30 on 64 bit machines.
"Small" integers, -5 to 256 are cached, but are represented as medium integers 
internally.

To a good approximation, all integers are "medium".

However, we make little effort to exploit that fact in the code for binary 
operations, which are very common operations on integers.

--
components: Interpreter Core
messages: 399832
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Integer operations are inefficient for "medium" integers.
type: performance

___
Python tracker 

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



[issue44941] Add check_methods function to collections.abc in standard library

2021-08-18 Thread Ken Jin


Change by Ken Jin :


--
nosy: +rhettinger, stutzbach
title: Add check_methods function to standard library -> Add check_methods 
function to collections.abc in standard library
versions: +Python 3.11

___
Python tracker 

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



[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-18 Thread Ken Jin


Ken Jin  added the comment:

Yep! You can choose to add a new section under "Other concrete types", maybe 
"typing.io and typing.re submodules" then talk about how we could import from 
them in the past, but they're now deprecated and going to be removed.

Alternatively, you can remove the existing notice, and just place a big note 
(..note::) underneath with the content above.

> I'm not sure if I'll have the time

No worries. We're not in a hurry. If you haven't checked it out already (and to 
save you some time) the devguide is here:
https://devguide.python.org/pullrequest/#quick-guide

You can probably skip some parts (like running tests) for a docs-only change. 
The main things are:
1. Please sign the CLA https://devguide.python.org/pullrequest/#licensing.
2. Make the change on main branch and send a PR over.

We can review your changes once the PR is open. Thanks for your interest in 
contributing! (once again, no pressure, if you feel at any time you're too busy 
to take this up, it's perfectly okay).

--

___
Python tracker 

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



[issue44945] Specialize BINARY_ADD using PEP 659 machinery.

2021-08-18 Thread Mark Shannon


New submission from Mark Shannon :

Specializing BINARY_ADD is worthwhile for two reasons:

Specializing for ints, floats and strings may give us some small speedup.

It removes the complex checks for the special case of extending a string, `s = 
s + ...` from the normal instruction to a specialized form.

--
messages: 399830
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Specialize BINARY_ADD using PEP 659 machinery.

___
Python tracker 

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



[issue44926] typing.get_type_hints() raises for type aliases with forward references

2021-08-18 Thread Maximilian Hils


Maximilian Hils  added the comment:

Thanks Guido! I agree on not pursuing the List["Foo"] case for the reasons you 
mentioned.

Let me know if you think it'd be useful to mention this limitation briefly in 
one of the relevant PEPs or somewhere else. I'm not sure if it meets the bar 
for notability, you probably have a better gut feeling for this.

Other than that I'd propose we close this here as wontfix. Thank you again for 
the very useful feedback! :)

--

___
Python tracker 

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



[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

2021-08-18 Thread STINNER Victor


STINNER Victor  added the comment:

_Py_DumpTracebackThreads() should not use Py_DECREF(). It's a bug. It must only 
*read* memory, not *modify* memory since it's called from a signal handler. 
It's a regression in dump_traceback().

Python 3.9 and 3.10 use:

frame = PyThreadState_GetFrame(tstate);
...
Py_DECREF(frame);

The main branch (future 3.11) uses:

frame = tstate->frame;

Without Py_DECREF(): it's a borrowed reference.

It was changed by commit ae0a2b756255629140efcbe57fc2e714f0267aa3.

Python 3.9 and 3.10 should be fixed to use a borrowed reference.

--
nosy: +vstinner

___
Python tracker 

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



[issue44929] Some RegexFlag cannot be printed in the repr

2021-08-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

Ethan, could you take a look at the PR? I added a few failing test methods 
since `repr` handling for global enum flags wasn't covered and looks 
unfinished. If you tell us what the expected return values should be, I'll 
finish the fix.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-18 Thread Mark Shannon


Mark Shannon  added the comment:

I'm somewhat surprised by that. After all, the only change in control flow was 
the change from a break to a goto in exception handling.
I would have expected PR27726 to have made much more difference.

There are a few possibilities, including:
1. It's just a random fluctuation from tiny changes in alignment.
2. MSVC aligns loops, but not switches, or vice-versa, and that makes a 
systematic difference.

I suspect that it is (1), but this is a bit worrying nonetheless.

--

___
Python tracker 

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



[issue41165] [Python 3.10] Remove APIs deprecated long enough

2021-08-18 Thread Hugo van Kemenade


Hugo van Kemenade  added the comment:

## unittest

What's needed to move forward with removing the deprecated aliases?

A deprecation warning is shown for `python3 -m unittest test_bar` and `python3 
test_bar.py` (tested Python 3.6-3.10).

No deprecation warning is shown for `python setup.py test`, however, both 
setuptools and pytest have deprecated/discouraged `python setup.py test`:

https://github.com/pypa/setuptools/pull/1878
https://github.com/pytest-dev/pytest/pull/5546
https://github.com/pytest-dev/pytest/issues/5534

Docs already mention they are deprecated:

https://docs.python.org/3/library/unittest.html#deprecated-aliases

> At a bare minimum you should list removed features in the 3.9 changelog and 
> porting guide as "will be removed in 3.10". I would even argue to add 
> deprecation warnings to the code in 3.9 (with permission from the RM). If the 
> RM is against deprecation warnings, then it might be good idea to postpone 
> removal to 3.11.

So at this stage (3.10 in RC), do we need to list them in the 3.11 changelog 
and porting guide as "will be removed in 3.12"?

--
nosy: +hugovk

___
Python tracker 

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



[issue44701] Create a @deprecated decorator (annotation)

2021-08-18 Thread Christian Buhtz


Christian Buhtz  added the comment:

This discussion on python-ideas
https://mail.python.org/archives/list/python-id...@python.org/thread/62CTVNQ2GIS4B6WUBX23K4CCCK5MCGYL/

--
nosy: +buhtz

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-18 Thread neonene


neonene  added the comment:

FYI, PR27727 ("Remove loop...") seems to be a bit slower than the previous 
commit (f08e6d1bb3c5655f184af88c6793e90908bb6338) on my Windows build 
(msvc14.29.16.10). pyperformance shows that

  Windows x64 PGO: 34 slower, 11 faster, 13 not significant, Geometric mean: 
1.02x slower
  Windows x86 PGO: 28 slower, 17 faster, 13 not significant, Geometric mean: 
1.02x slower

Undoing PR27727 on current cpython-main branch also get speed-ups by 1-2% on 
average.

--
nosy: +neonene

___
Python tracker 

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



[issue20041] TypeError when f_trace is None and tracing.

2021-08-18 Thread Ryan Mast (nightlark)


Change by Ryan Mast (nightlark) :


--
nosy: +rmast

___
Python tracker 

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



[issue26545] [doc] os.walk is limited by python's recursion limit

2021-08-18 Thread Ryan Mast (nightlark)


Change by Ryan Mast (nightlark) :


--
nosy: +rmast

___
Python tracker 

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



[issue15373] copy.copy() does not properly copy os.environment

2021-08-18 Thread Ryan Mast (nightlark)


Change by Ryan Mast (nightlark) :


--
nosy: +rmast

___
Python tracker 

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