[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Josh. super() uses a lot of magic, and in case of comprehensions 
it fails in interesting way.

Most common cases in which super() does not work:

1. Outside of a function defined in a class.
2. In a static method.
3. In inner function.
4. In comprehensions and generator expressions.

Idea #2 could help in cases 3 and 4.

--

___
Python tracker 

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-27 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Carlos: This has nothing to do with reloading (as Alex's repro shows, no reload 
calls are made).

super() *should* behave the same as super(CLASS_DEFINED_IN, self), and it looks 
like the outer function is doing half of what it must do to make no-arg super() 
work in the genexpr (dis.dis reports that __class__ is being loaded, and a 
closure constructed from the genexpr that includes it, so __class__, which 
no-arg super pulls from closure scope to get its first argument, is there).

The problem is that super() *also* assumes the first argument to the function 
is self, and a genexpr definitionally receives just one argument, the iterator 
(the outermost one for genexprs with nested loops). So no-arg super is doing 
the equivalent of:

super(__class__, iter(vars))

when it should be doing:

super(__class__, self)

Only way to fix it I can think of would be one of:

1. Allow a genexpr to receive multiple arguments to support this use case 
(ugly, requires significant changes to current design of genexprs and probably 
super() too)
2. Somehow teach super() to pull self (positional argument #1 really; super() 
doesn't care about names) from closure scope (and make the compiler put self in 
the closure scope when it builds the closure) when run in a genexpr.

Both options seem... sub-optimal. Better suggestions welcome. Note that the 
same problem affects the various forms of comprehension as well (this isn't 
specific to the lazy design of genexprs; listcomps have the same problem).

--
nosy: +josh.r

___
Python tracker 

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



[issue21910] [doc] File protocol should document if writelines must handle generators sensibly

2021-12-27 Thread Stanley


Stanley  added the comment:

I'd be interested in taking a look at this - would these changes clarify things?

Current (https://docs.python.org/3/library/codecs.html#codecs.StreamWriter):

Writes the concatenated list of strings to the stream (possibly by reusing the 
write() method). The standard bytes-to-bytes codecs do not support this method.

Proposed:

Writes the concatenated list of strings to the stream by reusing the write() 
method, and thus does not support infinite or very large generators. The 
standard bytes-to-bytes codecs do not support this method.

--
nosy: +slateny

___
Python tracker 

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



[issue46117] tk could not refresh auto in mac os

2021-12-27 Thread asper


asper  added the comment:

It looks like that Python3.10.1 has solved this question.
Now use grid_remove() and grid() to switch two widgets smoother than before on 
my mac system. 
Ronald Oussoren, Thank you for your time and advice, I could close this issue.

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



[issue45189] Drop the "list_frozen" command from _test_embed.

2021-12-27 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 196b53eb1e62871ca80dee180e4891b4dd5c52ac by Dong-hee Na in branch 
'main':
bpo-45189: Drop the "list_frozen" command from _test_embed. (GH-30273)
https://github.com/python/cpython/commit/196b53eb1e62871ca80dee180e4891b4dd5c52ac


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



[issue45189] Drop the "list_frozen" command from _test_embed.

2021-12-27 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue46185] Python 3.10.1 installer refers to /Applications/Python 3.9 Install Certificates

2021-12-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28496
pull_request: https://github.com/python/cpython/pull/30280

___
Python tracker 

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



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2021-12-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 10.0 -> 11.0
pull_requests: +28495
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30279

___
Python tracker 

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



[issue46185] Python 3.10.1 installer refers to /Applications/Python 3.9 Install Certificates

2021-12-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
nosy: +erlendaasland
nosy_count: 2.0 -> 3.0
pull_requests: +28494
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30278

___
Python tracker 

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2021-12-27 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FWIW, I've managed to reproduce once with win_py399_crash_reproducer.py on 
macOS 12.1 (with very high load average). With bug.py, I can reproduce almost 
always (more than 90% of the time).

--
nosy: +erlendaasland

___
Python tracker 

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



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +28493
pull_request: https://github.com/python/cpython/pull/30277

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

FWIW, when this need has turned up for me (which it has, a couple of times), 
I've used this:

def risqrt(n):
return (isqrt(n<<2) + 1) >> 1

But I'll admit that that's a bit non-obvious.

--

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-27 Thread Raymond Hettinger


New submission from Raymond Hettinger :

By default, isqrt(n) gives the floor of the exact square of n.  It would be 
nice to have a flag to give a rounded result:

y = isqrt(n, round=True)

Alternatively, set a mode argument to one of {'floor', 'round', 'ceil'}:

y = isqrt(n, mode='round')

I would like something better than this:

def risqrt(x):
'Big integer version of: round(sqrt(x)).'
y = isqrt(x)
s = y ** 2
return y if x <= s + y else y + 1

def cisqrt(x):
'Big integer version of: ceil(sqrt(x)).'
return isqrt(x - 1) + 1

My use case arose when building a table of square roots incorporated in 
arbitrary precision functions implemented with scaled integer arithmetic:

def get_root_table(base, steps, scale):
s = []
x = round(base * scale)
for i in range(steps):
x = risqrt(x * scale)
s.append(x)
return s

--
assignee: mark.dickinson
components: Library (Lib)
messages: 409243
nosy: mark.dickinson, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Optionally support rounding for math.isqrt()
type: enhancement
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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-27 Thread Eric Snow


Eric Snow  added the comment:

are there any objections to my PR?

--

___
Python tracker 

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



[issue26214] textwrap should minimize number of breaks in extra long words

2021-12-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It may be worth fixing wrap() to do the nicer style of wrapping for long words. 
If we decide to do that, it should be done via a new parameter because the same 
logic (TextWrapper class) is used for `shorten` and in that case it may be 
preferable to have the chunk of longer word rather than cutting it out entirely.

--
nosy: +andrei.avk
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

Two separate significant improvements have been pushed: thanks, Xinhang Xu!

The original PR also contained a reworking of the general case for 
right-shifting a negative integer. The current code (in main) for that case 
does involve some extra allocations, and it ought to be possible to write 
something that doesn't need to allocate temporary PyLongs.

--

___
Python tracker 

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



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-27 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 3581c7abbe15bad6ae08fc38887e5948f8f39e08 by Xinhang Xu in branch 
'main':
bpo-46055: Speed up binary shifting operators (GH-30044)
https://github.com/python/cpython/commit/3581c7abbe15bad6ae08fc38887e5948f8f39e08


--

___
Python tracker 

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



[issue46168] Incorrect format specified for the "style" key in the configuration file format formatter example

2021-12-27 Thread Samriddhi Bhardwaj


Samriddhi Bhardwaj  added the comment:

I would like to help with this issue. It should take me less than 5 days.

--
nosy: +samriddhi.bhardwaj

___
Python tracker 

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



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 360fedc2d2ce6ccb0dab554ef45fe83f7aea1862 by Mark Dickinson in 
branch 'main':
bpo-46055: Streamline inner loop for right shifts (#30243)
https://github.com/python/cpython/commit/360fedc2d2ce6ccb0dab554ef45fe83f7aea1862


--

___
Python tracker 

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



[issue46186] replace `io.IncrementalNewlineDecoder` with non incremental newline decoders

2021-12-27 Thread Guo Ci Teo


Guo Ci Teo  added the comment:

In any case, the use of an incremental newline decoder is not required

--

___
Python tracker 

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



[issue46186] replace `io.IncrementalNewlineDecoder` with non incremental newline decoders

2021-12-27 Thread Guo Ci Teo


Change by Guo Ci Teo :


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

___
Python tracker 

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



[issue46186] replace `io.IncrementalNewlineDecoder` with non incremental newline decoders

2021-12-27 Thread Guo Ci Teo


New submission from Guo Ci Teo :

replace unnecessary use of `io.IncrementalNewlineDecoder` in code.
Some uses of the `decode` method were also incorrect without the `final=True` 
argument.

--
messages: 409235
nosy: guoci
priority: normal
severity: normal
status: open
title: replace `io.IncrementalNewlineDecoder` with non incremental newline 
decoders

___
Python tracker 

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



[issue46109] Separate resources docs from other importlib docs

2021-12-27 Thread Eric Snow


Eric Snow  added the comment:

+1

--

___
Python tracker 

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-27 Thread Joseph Perez


Joseph Perez  added the comment:

There is also https://bugs.python.org/issue44293 about inspect.isclass

--
nosy: +joperez

___
Python tracker 

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



[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-12-27 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks! ✨  ✨

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-12-27 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 576e38f9db61ca09ca6dc57ad13b02a7bf9d370a by Miss Islington (bot) 
in branch '3.10':
bpo-42918: Improve built-in function compile() in mode 'single' (GH-29934) 
(GH-30040)
https://github.com/python/cpython/commit/576e38f9db61ca09ca6dc57ad13b02a7bf9d370a


--

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2021-12-27 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +28490
pull_request: https://github.com/python/cpython/pull/30275

___
Python tracker 

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



[issue45924] Incorrect traceback when future's exception is raised multiple times

2021-12-27 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 5.0 -> 6.0
pull_requests: +28489
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30274

___
Python tracker 

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



[issue46185] Python 3.10.1 installer refers to /Applications/Python 3.9 Install Certificates

2021-12-27 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily

___
Python tracker 

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



[issue45189] Drop the "list_frozen" command from _test_embed.

2021-12-27 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
nosy: +corona10
nosy_count: 2.0 -> 3.0
pull_requests: +28488
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30273

___
Python tracker 

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



[issue46166] Get "self" args or non-null co_varnames from frame object with C-API

2021-12-27 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +vstinner

___
Python tracker 

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



[issue46185] Python 3.10.1 installer refers to /Applications/Python 3.9 Install Certificates

2021-12-27 Thread Jaap Roes


New submission from Jaap Roes :

The Python 3.10.1 installer on macOS has the text "A sample command script is 
included in /Applications/Python 3.9" when mentioning the "Install 
Certificates" command. This location doesn't exist (unless one has installed 
Python 3.9).

The source of this text can be found here:

https://github.com/python/cpython/blob/f4c03484da59049eb62a9bfb963e2267d187/Mac/BuildScript/resources/ReadMe.rtf#L29

--
components: Installation
messages: 409230
nosy: jaap3, ned.deily
priority: normal
severity: normal
status: open
title: Python 3.10.1 installer refers to /Applications/Python 3.9 Install 
Certificates
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



[issue34963] String representation for types created with typing.NewType(…) are opaque and unappealing

2021-12-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> out of date
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



[issue18677] Enhanced context managers with ContextManagerExit and None

2021-12-27 Thread Alex Waygood


Alex Waygood  added the comment:

Given that this issue has seen no activity for eight years, I am closing it as 
"rejected".

--
nosy: +AlexWaygood
resolution:  -> rejected
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



[issue45863] tarfile zeroes ustar header fields unnecessarily

2021-12-27 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +ethan.furman

___
Python tracker 

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