Re: Best way to check if there is internet?

2022-02-22 Thread Dennis Lee Bieber
On Wed, 23 Feb 2022 07:08:27 +0300, Abdur-Rahmaan Janhangeer
 declaimed the following:


>The upcoming operation is short enough and
>though we cannot assume that it will be the case
>when we are running the operation, we sensibly
>assume it will still be the case.
>
>This is more an extra check to not start an operation than
>either relying to check at the start or when query.
>It's both.

So you have a success/fail tree of...

1   attempt a connection to some IP/port
1a  success -- attempt connection for desired operation
1a1 success -- operation completes
1a2 failure -- report that the operation can not be 
completed
1b  failure -- report that you will not attempt the operation
because your test connection to some site failed
EVEN IF THE OPERATION COULD SUCCEED
(if the problem is with "some IP/port", not
the rest of the network)

vs

1   attempt connection for desired operation
1a  success -- operation completes
1b  failure -- report that the operation cannot be completed

Personally the second tree is simpler -- AND NEEDS TO BE PART OF THE
OTHER TREE ANYWAY! [short tree 1/1a/1b are long tree 1a/1a1/1a2] The only
way the longer tree makes sense is by making step 1 a connection to the
IP/port requested in the desired operation -- and if that succeeds you've
basically performed the shorter tree.

>
>>


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I don't really understand all the hate around the idea of a cancel message. One 
reason it's useful is that it provides a simple way to say *why* something is 
being cancelled or *what* is cancelling it. It provides additional context to 
the exception, in the same way that a normal exception's message can provide 
additional helpful context.

Take for example this chunk of code:

import asyncio
import random

async def job():
await asyncio.sleep(5)

async def main():
task = asyncio.create_task(job())
await asyncio.sleep(1)
r = random.random()
if r < 0.5:
task.cancel()
else:
task.cancel()
await task

if __name__=="__main__":
asyncio.run(main())

Without passing a message, there's no way to tell which of the two lines called 
cancel, or why. The tracebacks are identical in both cases. This is even in the 
simplest case where only one cancellation is occurring. Passing a message lets 
one disambiguate the two call sites. And if there is truly a race condition 
where it's up in the air between two things cancelling it, I think it would be 
okay for the chosen message to be indeterminate, as either would have 
instigated the cancel in the absence of the other.

--

___
Python tracker 

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Neil Girdhar


Neil Girdhar  added the comment:

@eric

Good thinking.  Would it make sense to add to the documentation as well that 
the __post_init__ methods aren't collected, and you should call super's 
__post_init__ if there is one using something like

if hasattr(super(), "__post_init__"):
super().__post_init__()

Noting this will make it easier to point to the docs if someone wonders when 
they see code like this.

--

___
Python tracker 

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



Re: One-liner to merge lists?

2022-02-22 Thread Frank Millman

On 2022-02-22 5:45 PM, David Raymond wrote:

Is there a simpler way?



d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
[a for b in d.values() for a in b]

['aaa', 'bbb', 'ccc', 'fff', 'ggg']






Now that's what I was looking for.

I am not saying that I will use it, but as an academic exercise I felt 
sure that there had to be a one-liner in pure python.


I had forgotten about nested comprehensions. Thanks for the reminder.

Frank
--
https://mail.python.org/mailman/listinfo/python-list


[issue46832] unicodeobject.c doesn't compile when defined EXPERIMENTAL_ISOLATED_SUBINTERPRETERS, variable "interned" not found

2022-02-22 Thread Artyom Polkovnikov


New submission from Artyom Polkovnikov :

1) Downloaded https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tar.xz

2) Compiled under MSVC 2019 with define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS

3) Got compilation error of file Objects/unicodeobject.c at line 15931, about 
undefined variable "interned", it is function _PyUnicode_ClearInterned(), 
uncompilable code is "if (interned == NULL) {".


This happens because when EXPERIMENTAL_ISOLATED_SUBINTERPRETERS is defined then 
INTERNED_STRINGS is undefined hence global variable "static PyObject *interned 
= NULL;" is not created, and _PyUnicode_ClearInterned() uses this global 
variable "interned".

For reference attaching my version of "unicodeobject.c" which has compilation 
error at line 15931.

--
components: Subinterpreters
files: unicodeobject.c
messages: 413774
nosy: artyom.polkovnikov
priority: normal
severity: normal
status: open
title: unicodeobject.c doesn't compile when defined 
EXPERIMENTAL_ISOLATED_SUBINTERPRETERS, variable "interned" not found
type: compile error
versions: Python 3.10
Added file: https://bugs.python.org/file50637/unicodeobject.c

___
Python tracker 

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



Re: One-liner to merge lists?

2022-02-22 Thread Avi Gross via Python-list
I had to think about it too, David.

Renaming it lets it make a bit more sense:

[item for sublist in d.values() for item in sublist]

This spells it out for me that you are taking one list within the main list at 
a time and then taking one item at a time from the list. Since the nesting is 
consistent in this case it makes sense.

Sadly, I could break it easily by just adding a non-list item like this:

d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg'], 3: 666}

And, of course, if you nest it any deeper, it is not completely flattened.

Chris makes the point that using the chain version may be better as it is 
compiled in C. Really? I would prefer a solution that even if slower, is more 
robust. Is there some function already written that will flatten what is given 
to it by checking the type of what is supplied, and based on the type, 
returning any simple objects like numbers or a character string, and converting 
many other composite things to something like a list and after popping off an 
entry, calling itself recursively on the rest until the list is empty? 

This would be a good start:

def flatten2list(object):
gather = []
for item in object:
if isinstance(item, (list, tuple, set)):
gather.extend(flatten2list(item))
else:
gather.append(item)
return gather

Of course I had to call the above as:

flatten2list(d.values())
['aaa', 'bbb', 'ccc', 'fff', 'ggg']

Here is a more complex version of the dictionary:

d = {1: ['aaa', 'bbb', 'ccc'], 2: [['fff', ['ggg']]], 3: 666, 4: set(["a", "e", 
"i", "o", "u"])}
d.values()
dict_values([['aaa', 'bbb', 'ccc'], [['fff', ['ggg']]], 666, {'e', 'u', 'a', 
'o', 'i'}])

flatten2list(d.values())

['aaa', 'bbb', 'ccc', 'fff', 'ggg', 666, 'e', 'u', 'a', 'o', 'i']


The quest for a one-liner sometimes forgets that a typical function call is 
also a one-liner, with the work hidden elsewhere, often in a module written in 
python or mainly in C and so on. I suspect much more detailed functions like 
the above are available with a little search that handle more including just 
about any iterable that terminates.


-Original Message-
From: Dan Stromberg 
To: David Raymond 
Cc: python-list@python.org 
Sent: Tue, Feb 22, 2022 11:02 pm
Subject: Re: One-liner to merge lists?


On Tue, Feb 22, 2022 at 7:46 AM David Raymond 
wrote:

> > Is there a simpler way?
>
> >>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
> >>> [a for b in d.values() for a in b]
> ['aaa', 'bbb', 'ccc', 'fff', 'ggg']
> >>>
>

I like that way best.

But I'd still:
1) use a little more descriptive identifiers
2) put it in a function with a descriptive name
3) give the function a decent docstring

-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45459] Limited API support for Py_buffer

2022-02-22 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

clang doesn't like the typedef forward-decl:

In file included from ../cpython/Modules/_ctypes/_ctypes.c:108:
In file included from ../cpython/Include/Python.h:43:
../cpython/Include/object.h:109:3: warning: redefinition of typedef 'PyObject' 
is a C11 feature [-Wtypedef-redefinition]
} PyObject;
  ^
../cpython/Include/pybuffer.h:23:24: note: previous definition is here
typedef struct _object PyObject;
   ^
1 warning generated.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue46806] Overlapping PYTHONPATH may cause import already imported module

2022-02-22 Thread aklajnert


aklajnert  added the comment:

I agree that adding a package directory to PYTHONPATH is not a good idea, 
however, I've stumbled on it in two completely independent companies' 
codebases. So it makes me suspect that this is may not be that rare case.

In the previous company we got bitten by this problem, and debugging took quite 
some time as this issue usually doesn't reveal immediately.

If the relative path is resolved to the same module as not relative, then the 
behavior when the same file's path but referenced in a slightly different way 
isn't seems at least inconsistent. Note that the absolute path to the module is 
exactly the same, the only thing that is different is how you reference it.

I'm happy to make an attempt to fix it if it gets acknowledged as a bug (a 
little guidance would be also helpful).

--
status: pending -> open

___
Python tracker 

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 288af845a32fd2a92e3b49738faf8f2de6a7bf7c by Eric V. Smith in 
branch 'main':
bpo-46757: Add a test to verify dataclass's __post_init__ isn't being 
automatically added. (GH-31523)
https://github.com/python/cpython/commit/288af845a32fd2a92e3b49738faf8f2de6a7bf7c


--

___
Python tracker 

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



Re: One-liner to merge lists?

2022-02-22 Thread Chris Angelico
On Wed, 23 Feb 2022 at 15:04, Dan Stromberg  wrote:
>
> On Tue, Feb 22, 2022 at 7:46 AM David Raymond 
> wrote:
>
> > > Is there a simpler way?
> >
> > >>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
> > >>> [a for b in d.values() for a in b]
> > ['aaa', 'bbb', 'ccc', 'fff', 'ggg']
> > >>>
> >
>
> I like that way best.
>
> But I'd still:
> 1) use a little more descriptive identifiers
> 2) put it in a function with a descriptive name
> 3) give the function a decent docstring

If you're going to do that, then you may as well use list(chain()) and
let the work be done in C.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm adding a test that mimic's Raymond's example of the proposed addition being 
a breaking change. This way, if we ever decide to actually add this feature, 
we'll break this test. If we do decide to continue and make the change anyway, 
at least we'll do so with the knowledge that it's a breaking change.

--

___
Python tracker 

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-22 Thread Eric V. Smith


Change by Eric V. Smith :


--
pull_requests: +29650
pull_request: https://github.com/python/cpython/pull/31523

___
Python tracker 

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



Re: Best way to check if there is internet?

2022-02-22 Thread Abdur-Rahmaan Janhangeer
>
> > Since you have to deal with things that you do not control changing
> after you check what is the point in checking? You have to write the code
> to recover anyway.
>


Well foe my usecase, the operation running is not
in months or a really long time. As Avi mentionned above,
that would be pointless.

The upcoming operation is short enough and
though we cannot assume that it will be the case
when we are running the operation, we sensibly
assume it will still be the case.

This is more an extra check to not start an operation than
either relying to check at the start or when query.
It's both.

>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36595] IDLE: Add search to textview.ViewWindow

2022-02-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#46830 is a duplicate request.

--
versions: +Python 3.11 -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



[issue46830] Add Find functionality to Squeezed Text viewer

2022-02-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: Add search to textview.ViewWindow

___
Python tracker 

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



Re: One-liner to merge lists?

2022-02-22 Thread Dan Stromberg
On Tue, Feb 22, 2022 at 7:46 AM David Raymond 
wrote:

> > Is there a simpler way?
>
> >>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
> >>> [a for b in d.values() for a in b]
> ['aaa', 'bbb', 'ccc', 'fff', 'ggg']
> >>>
>

I like that way best.

But I'd still:
1) use a little more descriptive identifiers
2) put it in a function with a descriptive name
3) give the function a decent docstring
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46831] Outdated comment for __build_class__ in compile.c

2022-02-22 Thread Shantanu


Change by Shantanu :


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

___
Python tracker 

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



[issue46831] Outdated comment for __build_class__ in compile.c

2022-02-22 Thread Shantanu


New submission from Shantanu :

https://github.com/python/cpython/blob/cf345e945f48f54785799390c2e92c5310847bd4/Python/compile.c#L2537
```
/* ultimately generate code for:
  = __build_class__(, , *, **)
   where:
  is a function/closure created from the class body;
it has a single argument (__locals__) where the dict
(or MutableSequence) representing the locals is passed
```

`func` currently takes zero arguments. This was changed in 
https://github.com/python/cpython/commit/e8e14591ebb729b4fa19626ce245fa0811cf6f32
 in Python 3.4

--
assignee: docs@python
components: Documentation
messages: 413768
nosy: docs@python, hauntsaninja
priority: normal
severity: normal
status: open
title: Outdated comment for __build_class__ in compile.c

___
Python tracker 

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



[issue46622] Add an async variant of lru_cache for coroutines.

2022-02-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
title: Add a async variant of lru_cache for coroutines. -> Add an async variant 
of lru_cache for coroutines.

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-02-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

> If some code is used together with timeout() and this code calls
> `.cancel()` but forgot about `.uncancel()` in try/except/finally --
> timeout() never raises TimeoutError.

Could you show an example? I'm not sure from this description who cancels whom 
and where the try/except/finally is in relation to the rest.

If you have something that catches CancelledError and then ignores it, e.g.

while True:
try:
await 
except CancelledError:
pass

then that's an immortal task and it shouldn't be run inside a timeout.

If you have something that catches CancelledError once, e.g.

try:
await 
finally:
await 

there should be no need to call .uncancel() *unless* the  may hang -- 
in that case you could write

try:
await 
finally:
async with timeout(5):
await 

I'm not sure that we should recommend using .uncancel() except in very special 
cases (e.g. when writing a timeout() context manager :-) and those cases should 
just be tested.

--

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 87cebb1e69758aa8b79f8e15187b976d62cba36a by Miss Islington (bot) 
in branch '3.9':
bpo-46794: Bump up the libexpat version into 2.4.6 (GH-31487)
https://github.com/python/cpython/commit/87cebb1e69758aa8b79f8e15187b976d62cba36a


--

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 4955a9ed14c681ed835bc8902a9db0bcc728bdee by Miss Islington (bot) 
in branch '3.10':
bpo-46794: Bump up the libexpat version into 2.4.6 (GH-31487)
https://github.com/python/cpython/commit/4955a9ed14c681ed835bc8902a9db0bcc728bdee


--

___
Python tracker 

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



[issue46622] Add a async variant of lru_cache for coroutines.

2022-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If this goes forward, my strong preference is to have a separate async_lru() 
function  just like the referenced external project.

For non-async uses, overloading the current lru_cache makes it confusing to 
reason about. It becomes harder to describe clearly what the caches do or to 
show a pure python equivalent.  People are already challenged to digest the 
current capabilities and are already finding it difficult to reason about when 
references are held.  I don't want to add complexity, expand the docs to be 
more voluminous, cover the new corner cases, and add examples that don't make 
sense to non-async users (i.e. the vast majority of python users).  Nor do I 
want to update the recipes for lru_cache variants to all be async aware.  So, 
please keep this separate (it is okay to share some of the underlying 
implementation, but the APIs should be distinct).

Also as a matter of fair and equitable policy, I am concerned about taking the 
core of a popular external project and putting in the standard library.  That 
would tend to kill the external project, either stealing all its users or 
leaving it as something that only offers a few incremental features above those 
in the standard library.  That is profoundly unfair to the people who created, 
maintained, and promoted the project.

Various SC members periodically voice a desire to move functionality *out* of 
the standard library and into PyPI rather than the reverse.  If a popular 
external package is meeting needs, perhaps it should be left alone.

As noted by the other respondants, caching sync and async iterators/generators 
is venturing out on thin ice.  Even if it could be done reliably (which is 
dubious), it is likely to be bug bait for users.  Remember, we already get 
people who try to cache time(), random() or other impure functions.  They cache 
methods and cannot understand why references is held for the instance.  
Assuredly, coroutines and futures will encounter even more misunderstandings. 

Also, automatic reiterability is can of worms and would likely require a PEP. 
Every time subject has come up before, we've decided not to go there.  Let's 
not make a tool that makes user's lives worse.  Not everything should be 
cached.  Even if we can, it doesn't mean we should.

--
title: Support  decorating a coroutine with functools.lru_cache -> Add a async 
variant of lru_cache for coroutines.

___
Python tracker 

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



[issue46765] Replace Locally Cached Strings with Statically Initialized Objects

2022-02-22 Thread Eric Snow


Change by Eric Snow :


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



[issue46828] math.prod can return integers (contradicts doc)

2022-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'll add a note that the output type is determined by the input type.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29647
pull_request: https://github.com/python/cpython/pull/31520

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 1935e1cc284942bec8006287c939e295e1a7bf13 by Dong-hee Na in branch 
'main':
bpo-46794: Bump up the libexpat version into 2.4.6 (GH-31487)
https://github.com/python/cpython/commit/1935e1cc284942bec8006287c939e295e1a7bf13


--

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29648
pull_request: https://github.com/python/cpython/pull/31521

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29646
pull_request: https://github.com/python/cpython/pull/31519

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-22 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44337] Port LOAD_ATTR to adaptive interpreter

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 3.0 -> 4.0
pull_requests: +29644
pull_request: https://github.com/python/cpython/pull/31517

___
Python tracker 

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



[issue46830] Add Find functionality to Squeezed Text viewer

2022-02-22 Thread Jeff Cagle


New submission from Jeff Cagle :

Squeezed text output currently opens in a viewer whose only functionality is 
scrolling.  Adding the Find widget a la IDLE would make the viewer much more 
useful.

--
assignee: terry.reedy
components: IDLE
messages: 413761
nosy: Jeff.Cagle, terry.reedy
priority: normal
severity: normal
status: open
title: Add Find functionality to Squeezed Text viewer
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



[issue46771] Add some form of cancel scopes

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

If some code is used together with timeout() and this code calls `.cancel()` 
but forgot about `.uncancel()` in try/except/finally -- timeout() never raises 
TimeoutError.

Should we care? The missing `.uncancel()` call is hard to detect by the runtime 
and static checkers.

--

___
Python tracker 

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



[issue46522] concurrent.futures.__getattr__ raises the wrong AttributeError message

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46522] concurrent.futures.__getattr__ raises the wrong AttributeError message

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46522] concurrent.futures.__getattr__ raises the wrong AttributeError message

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 9b12b1b803d7b73640ab637a74a6f35f3fe9db21 by Thomas Grainger in 
branch 'main':
bpo-46522: fix concurrent.futures and io AttributeError messages (GH-30887)
https://github.com/python/cpython/commit/9b12b1b803d7b73640ab637a74a6f35f3fe9db21


--
nosy: +asvetlov

___
Python tracker 

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



[issue46765] Replace Locally Cached Strings with Statically Initialized Objects

2022-02-22 Thread Eric Snow


Eric Snow  added the comment:


New changeset 1f455361ecfb1892e375bdbee813cdf095b6cfb8 by Eric Snow in branch 
'main':
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects 
(gh-31366)
https://github.com/python/cpython/commit/1f455361ecfb1892e375bdbee813cdf095b6cfb8


--

___
Python tracker 

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



[issue45885] Specialize COMPARE_OP

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 2.0 -> 3.0
pull_requests: +29643
pull_request: https://github.com/python/cpython/pull/31516

___
Python tracker 

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



[issue40358] pathlib's relative_to should behave like os.path.relpath

2022-02-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

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



[issue44078] Output relative path when using PurePath.relative_to

2022-02-22 Thread Socob


Change by Socob <206a8...@opayq.com>:


--
nosy: +Socob

___
Python tracker 

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



[issue42234] pathlib relative_to behaviour change

2022-02-22 Thread Socob


Change by Socob <206a8...@opayq.com>:


--
nosy: +Socob

___
Python tracker 

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



[issue40358] pathlib's relative_to should behave like os.path.relpath

2022-02-22 Thread Socob


Change by Socob <206a8...@opayq.com>:


--
nosy: +Socob

___
Python tracker 

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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29642
pull_request: https://github.com/python/cpython/pull/31515

___
Python tracker 

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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2022-02-22 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Deprecation is a good answer. 
Let's not forget to apply it to 3.11 then.

--

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-02-22 Thread Tin Tvrtković

Change by Tin Tvrtković :


--
pull_requests: +29640
pull_request: https://github.com/python/cpython/pull/31513

___
Python tracker 

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



[issue43119] asyncio.Queue.put never yields if the queue is unbounded

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Sorry, that's how asyncio works: it never switches to another task if `await 
...` doesn't need to wait for something actually.

Adding `await asyncio.sleep(0)` to every call decreases performance.

--
resolution:  -> wont fix
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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

I would like to go on record (again) as preferring to get rid of the 
cancel-message parameter altogether. Let's deprecate it. When we initially 
designed things without a cancel message we did it on purpose -- "cancellation" 
is a single flag, not a collection of data.

--

___
Python tracker 

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



[issue31327] [doc] Add example of platform-specific support for negative timestamps to the time doc

2022-02-22 Thread Vidhya


Vidhya  added the comment:

[Entry level contributor seeking guidance]If this is not yet fixed, I can work 
on this. Please let me know.

--
nosy: +vidhya

___
Python tracker 

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



[issue45883] reuse_address mistakenly removed from loop.create_server

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
assignee:  -> asvetlov

___
Python tracker 

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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What about `CancelledError(*msg_list)` or 
`CancelledError(*reversed(msg_list))`? It is backward compatible and all 
messages are uniformely represented.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45459] Limited API support for Py_buffer

2022-02-22 Thread STINNER Victor


STINNER Victor  added the comment:

pmp-p:
> There's some side effects with "buffer.h" inclusion in Panda3D when building 
> againt 3.11a5, project manager concerns are here 
> https://github.com/python/cpython/pull/29991#issuecomment-1031731100

Thanks for the report. It has been fixed. I close again the issue.

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



[issue45100] Improve help() by making typing.overload() information accessible at runtime

2022-02-22 Thread Alex Waygood


Alex Waygood  added the comment:

I'd dearly like better introspection tools for functions decorated with 
@overload, but I'd rather have a solution where:

- inspect.signature doesn't have to import typing. That doesn't feel worth it 
for users who aren't using typing.overload, but inspect.signature would have to 
import typing whether or not @overload was being used, in order to *check* 
whether @overload was being used.
- The solution could be reused by, and generalised to, other kinds of functions 
that have multiple signatures.

If we create an __overloads__ dunder that stored the signatures of 
multi-signature functions, as Raymond suggests, inspect.signature could check 
that dunder to examine whether the function is a multi-dispatch signature, and 
change its representation of the function accordingly. This kind of solution 
could be easily reused by other parts of the stdlib, like 
@functools.singledispatch, and by third-party packages such as plum-dispatch, 
multipledispatch, and Nikita's dry-python/classes library.

So, while it would undoubtedly be more complex to implement, I much prefer 
Raymond's suggested solution.

--

___
Python tracker 

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



[issue45459] Limited API support for Py_buffer

2022-02-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 66b3cd7063322a9f5c922a97bbd06fdb9830 by Victor Stinner in 
branch 'main':
bpo-45459: Rename buffer.h to pybuffer.h (#31201)
https://github.com/python/cpython/commit/66b3cd7063322a9f5c922a97bbd06fdb9830


--

___
Python tracker 

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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-02-22 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29638
pull_request: https://github.com/python/cpython/pull/31511

___
Python tracker 

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Andrew Svetlov


New submission from Andrew Svetlov :

Suppose multiple `task.cancel(msg)` with different messages are called on the 
same event loop iteration.

What message (`cancel_exc.args[0]`) should be sent on the next loop iteration?

As of Python 3.10 it is the message from the *last* `task.cancel(msg)` call. 
The main branch changed it to the *first* message (it is a subject for 
discussion still).
Both choices are equally bad. The order of tasks execution at the same loop 
iteration is weak and depends on very many circumstances. Effectively, 
first-cancelled-message and last-cancelled-message are equal to random-message.

This makes use of cancellation message not robust: a task can be cancelled by 
many sources, task-groups adds even more mess.

Guido van Rossum suggested that messages should be collected in a list and 
raised altogether. There is a possibility to do it in a backward-compatible 
way: construct the exception as `CancelledError(last_msg, tuple(msg_list))`. 
args[0] is args[1][-1]. Weird but works.

`.cancel()` should add `None` to the list of cancelled messages.
The message list should be cleared when a new CancelledError is constructed and 
thrown into cancelling task.

Working with exc.args[0] / exc.args[1] is tedious and error-prone. I propose 
adding `exc.msgs` property. Not sure if the last added message is worth a 
separate attribute, a robust code should not rely on messages order as I 
described above.

The single message is not very useful but a list of messages can be used in 
timeouts implementation as cancellation count alternative.

I don't have a strong preference now but want to carefully discuss possible 
opportunities before making the final decision.

--
components: asyncio
messages: 413749
nosy: ajoino, alex.gronholm, asvetlov, chris.jerdonek, dreamsorcerer, 
gvanrossum, iritkatriel, jab, njs, tinchester, yselivanov
priority: normal
severity: normal
status: open
title: Confusing CancelError message if multiple cancellations are scheduled
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



[issue45146] Add a possibility for asyncio.Condition to determine the count of currently waiting consumers

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Sorry, your use-case looks not convincing but overcomplicated.

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 29e8c43b32d6f1ec2e8b4fd8c4903d30830f280f by Miss Islington (bot) 
in branch '3.9':
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
https://github.com/python/cpython/commit/29e8c43b32d6f1ec2e8b4fd8c4903d30830f280f


--

___
Python tracker 

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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset d327517b54c148eba499c777b99760356102cbe0 by Miss Islington (bot) 
in branch '3.10':
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
https://github.com/python/cpython/commit/d327517b54c148eba499c777b99760356102cbe0


--

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b899126094731bc49fecb61f2c1b7557d74ca839 by Victor Stinner in 
branch 'main':
bpo-46659: Deprecate locale.getdefaultlocale() (GH-31206)
https://github.com/python/cpython/commit/b899126094731bc49fecb61f2c1b7557d74ca839


--

___
Python tracker 

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



Re: Best way to check if there is internet?

2022-02-22 Thread Barry


> On 22 Feb 2022, at 17:44, Abdur-Rahmaan Janhangeer  
> wrote:
> 
> Well, nice perspective.
> 
> It's a valid consideration, sound theory
> but poor practicality according to me.
> 
> It you view it like this then between the moment
> we press run or enter key on the terminal,
> our Python interpreter might get deleted.

This is under your control usually so you do not need to check for python to be 
installed.
> 
> We never know, it can happen.
> 
> Though it's nice to go in and catch exceptions,
> if you have a long operation upcoming it might be nice
> to see if your key element is present.

You might check for enough disk space before starting to ensure that you can 
write the results, again this is usually under your control.

But you do not control the internet as an end user.
As it is not under your control you have to code to survive its failure modes.
For example email delivery is retried until the MTA gives up or succeeds.

> 
> Much like checking if goal posts are present before
> starting a football game. You can of course start
> the match, pass the ball around and when shooting
> you stop the match as you realise that the goal posts
> are not around.

Check before you start. But you are going to notice people attempting to take 
goal posts away while you play.

> Checking by exceptions is what the snippet
> i shared does. But we check for the ability to do it
> before we start.
> 
> Of course, it can change in the seconds that follow. But it's too much pure
> logic at work.

Since you have to deal with things that you do not control changing after you 
check what is the point in checking? You have to write the code to recover 
anyway.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ccbe8045faf6e63d36229ea4e1b9298572cda126 by Victor Stinner in 
branch 'main':
bpo-46659: Fix the MBCS codec alias on Windows (GH-31218)
https://github.com/python/cpython/commit/ccbe8045faf6e63d36229ea4e1b9298572cda126


--

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-22 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset fdfd7a93540b0866ba42264ecb9b0a3c2286f654 by Łukasz Langa 
(Sebastian Pipping) in branch '3.8':
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453)
https://github.com/python/cpython/commit/fdfd7a93540b0866ba42264ecb9b0a3c2286f654


--

___
Python tracker 

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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 8fb94893e4a870ed3533e80c4bc2f1ebf1cfa9e7 by Thomas Grainger in 
branch 'main':
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
https://github.com/python/cpython/commit/8fb94893e4a870ed3533e80c4bc2f1ebf1cfa9e7


--

___
Python tracker 

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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29637
pull_request: https://github.com/python/cpython/pull/31510

___
Python tracker 

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



[issue46827] asyncio SelectorEventLoop.sock_connect fails with a UDP socket

2022-02-22 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-02-22 Thread Tin Tvrtković

Change by Tin Tvrtković :


--
pull_requests: +29635
pull_request: https://github.com/python/cpython/pull/31508

___
Python tracker 

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



Re: Best way to check if there is internet?

2022-02-22 Thread Abdur-Rahmaan Janhangeer
I've got my answers but the 'wandering' a bit
on this thread is at least connected to the topic ^^.

Last question: If we check for wifi or ethernet cable connection?

Wifi sometimes tell of connected but no internet connection.
So it detected that there is or there is no internet ...
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46828] math.prod can return integers (contradicts doc)

2022-02-22 Thread Neil Webber


New submission from Neil Webber :

The math module documentation says:

   Except when explicitly noted otherwise, all return values are floats.

But this code returns an integer:

   from math import prod; prod((1,2,3))

Doc should "explicitly note otherwise" here, I imagine. The issue being wanting 
to know that the result on all-integer input will be an exact (integer) value 
not a floating value.

--
assignee: docs@python
components: Documentation
messages: 413741
nosy: docs@python, neilwebber
priority: normal
severity: normal
status: open
title: math.prod can return integers (contradicts doc)
type: behavior

___
Python tracker 

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



[issue46632] test_ssl: 2 tests fail on cstratak-CentOS9-fips-x86_64

2022-02-22 Thread STINNER Victor


STINNER Victor  added the comment:

Same on AMD64 CentOS9 FIPS Only Blake2 Builtin Hash 3.x:
https://buildbot.python.org/all/#/builders/828/builds/196

test.pythoninfo:

fips.linux_crypto_fips_enabled: 1
fips.openssl_fips_mode: 1
ssl.OPENSSL_VERSION: OpenSSL 3.0.1 14 Dec 2021
ssl.OPENSSL_VERSION_INFO: (3, 0, 0, 1, 0)

==
ERROR: test_load_verify_cadata (test.test_ssl.ContextTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-CentOS9-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_ssl.py",
 line 1494, in test_load_verify_cadata
ctx.load_verify_locations(cadata=cacert_der)

ssl.SSLError: [EVP] unsupported (_ssl.c:4009)

==
ERROR: test_connect_cadata (test.test_ssl.SimpleBackgroundTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-CentOS9-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_ssl.py",
 line 2138, in test_connect_cadata
ctx.load_verify_locations(cadata=der)
^
ssl.SSLError: [EVP] unsupported (_ssl.c:4009)

Stdout:
 server:  new connection from ('127.0.0.1', 38484)
 server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)

--

___
Python tracker 

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



Re: Best way to check if there is internet?

2022-02-22 Thread Chris Angelico
On Wed, 23 Feb 2022 at 05:38, Avi Gross via Python-list
 wrote:
> It sounds to me like your main issue is not whether the internet is up right 
> now but whether the user has an internet connection. If they run the program 
> on a laptop at home or work then they may well be connected, but sitting in 
> their car in some parking lot, may well not be.
>

Very seldom, a computer actually has *no* network connection. Much
more often, you have a network connection, but it's not very useful.
For example, you might have full network connectivity... but only on
localhost. Or you might be on a LAN, and fully able to access its
resources, but your uplink to the rest of the internet is down. Or
maybe you're a server inside Facebook, and the rest of the internet is
slowly getting disconnected from you. Do you have an internet
connection? Do you have what you need?

*There is no way* to answer the question of whether you have internet
access, other than to try the exact thing you want to do, and see if
it fails. People who think that there's a binary state of "have
internet" // "do not have internet" have clearly never worked in
networking

(No, I've never accidentally misconfigured a network so that we had
full access to everything *except* the local network. Why do you ask?
Anyway, I fixed it within a few minutes.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you @vidhya!

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 2387aeacc78bfd9d314428b79590b2b47511bf33 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-20923 : [doc] Explain ConfigParser 'valid section name'  and .SECTCRE 
(GH-31413) (GH-31507)
https://github.com/python/cpython/commit/2387aeacc78bfd9d314428b79590b2b47511bf33


--

___
Python tracker 

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



Re: Best way to check if there is internet?

2022-02-22 Thread Avi Gross via Python-list
As usual, his discussion is wandering a bit.

Yes, some things are not reliable but sometimes a heuristic answer is better 
than none.

Internet connections are beyond flaky and worse the connection you want may be 
blocked for many reasons even if other connections you try are working. Any 
number of routers can lose power or you personally may be blocked by something 
if they deem the place you want unsafe and much more.

In Statistics, you often work not with TRUE and FALSE but with ranges of 
probability and you may deem something as tentatively true if it is 95% or 99% 
likely it did not happen by chance given your sample.

But for a long-running program, checking if the internet is up ONCE is clearly 
not good enough if it runs for months at a time. Checking right before making a 
connection may be a bit much too.

But computers often spend a majority of their time doing things like checking. 
If I am using a GUI and the process is waiting to see if I type some key (or 
even am depressing the Shift key which normally does not generate any symbols 
by itself) and also testing if my mouse is moving or has moved over an area or 
one of several buttons has been clicked, then what may be happening is 
something in a loop that keeps checking and when an event has happened, 
notifies something to continue and perhaps provides the results. Something 
along those lines can happen when say a region of memory/data is being shared 
and one part wants to know if the memory is still locked or has finally been 
written to by another part and can be read and so on.

For something important, it is not enough to check if a file system is mounted 
and available and then write the file and move on. You may want to not only 
test the exit status of the write, or arrange to catch exceptions, but to then 
re-open the file and read in what you wrote and verify that it seems correct. 
In some cases, you get even more paranoid and save some kind of log entry that 
can be used to recreate the scenario if something bad happens and store that in 
another location in case there is a fire or something. 

So the answer is that it is up to you to decide how much effort is warranted. 
Can you just try a connection and react if it fails or must you at least get a 
decent guess that there is an internet connection of some kind up and running 
or must it be ever more bulletproof?

A scenario might be one where you are providing info and can adjust depending 
on various settings. If the user has an internet connection on, you can use 
video and graphics and so on that result in something current. But if they have 
settings suggesting they want to minimize the data they send and receive, the 
same request may result in the browser you invoked showing them just some 
alternative text. You have no way of knowing. Again, if the internet is not up, 
you may just present your own canned text, perhaps dated. Or, you can suggest 
to the user they turn on the internet and try again, or ...

It sounds to me like your main issue is not whether the internet is up right 
now but whether the user has an internet connection. If they run the program on 
a laptop at home or work then they may well be connected, but sitting in their 
car in some parking lot, may well not be.




-Original Message-
From: Abdur-Rahmaan Janhangeer 
To: Python 
Sent: Tue, Feb 22, 2022 12:32 pm
Subject: Re: Best way to check if there is internet?


Well, nice perspective.

It's a valid consideration, sound theory
but poor practicality according to me.

It you view it like this then between the moment
we press run or enter key on the terminal,
our Python interpreter might get deleted.

We never know, it can happen.

Though it's nice to go in and catch exceptions,
if you have a long operation upcoming it might be nice
to see if your key element is present.

Much like checking if goal posts are present before
starting a football game. You can of course start
the match, pass the ball around and when shooting
you stop the match as you realise that the goal posts
are not around.

Checking by exceptions is what the snippet
i shared does. But we check for the ability to do it
before we start.

Of course, it can change in the seconds that follow. But it's too much pure
logic at work.

-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-22 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



[issue46729] Better str() for BaseExceptionGroup

2022-02-22 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Cooper Lees


Cooper Lees  added the comment:

FWIW - Will be looking to add to flake8-bugbear here: 
https://github.com/PyCQA/flake8-bugbear/issues/222

--

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Cooper Lees


Cooper Lees  added the comment:

I would never want to do that ... I understand it's bad. Just questioning 
things before adding lints so we put things in the right places and more 
importantly making sure I understand.

Thanks for the discussion all.

--

___
Python tracker 

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



[issue46729] Better str() for BaseExceptionGroup

2022-02-22 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 38b5acf8673ce42a401263a2528202e44d6ae60a by Irit Katriel in 
branch 'main':
bpo-46729: add number of sub-exceptions in str() of BaseExceptionGroup 
(GH-31294)
https://github.com/python/cpython/commit/38b5acf8673ce42a401263a2528202e44d6ae60a


--

___
Python tracker 

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset a7af34d407b344de7f138c002854a3e16ecb9db5 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-20923 : [doc] Explain ConfigParser 'valid section name'  and 
.SECTCRE (GH-31413) (GH-31506)
https://github.com/python/cpython/commit/a7af34d407b344de7f138c002854a3e16ecb9db5


--

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, I say that

with suppress():
...

is equivalent to

try:
...
except ():
pass

or

try:
...
except BaseException as err:
if not isinstance(err, ()):
raise

If you want to suppress all exceptions (it is not very clever idea), use 
suppress(BaseException).

--

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Zachary Ware


Zachary Ware  added the comment:

>>> try:
... raise ValueError("I raise...")
... except ():
... pass
... 
Traceback (most recent call last):
  File "", line 2, in 
ValueError: I raise...

--

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Cooper Lees


Cooper Lees  added the comment:

Ok thanks. Looks like the warning in flake8-bugbear is the right place then, 
unfortunately.

And just to be sure:

> Note that suppress without arguments corresponds to "except" and isinstance() 
> with empty tuple.

Are you saying that `contextlib.suppress()` should effectively `except 
BaseException` (cause this is not the behavior from my tests) and suppress all 
or suppress nothing? I believe the empty tuple makes it except nothing?

```python
cooper@home1:~$ python3.11
Python 3.11.0a5+ (main, Feb 22 2022, 08:51:50) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
>>> with contextlib.suppress():
...   raise ValueError("I raise ...")
...
Traceback (most recent call last):
  File "", line 2, in 
ValueError: I raise ...
>>>
```

--

___
Python tracker 

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



[issue46825] slow matching on regular expression

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The re module does not support features corresponding to 
std::regex_constants::__polynomial in C++. Rewrite your regular expression or 
try to use alternative regex implementations (for example wrappers around the 
re2 library or C++ regex library).

--
nosy: +serhiy.storchaka
resolution:  -> wont fix
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



[issue43545] Use LOAD_GLOBAL to set __module__ in class def

2022-02-22 Thread Irit Katriel


Irit Katriel  added the comment:

Please reopen or create and new issue if this is still relevant and you can 
provide more information.

--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue46717] Raising exception multiple times leaks memory

2022-02-22 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Zachary.

Note that suppress without arguments corresponds to "except" and isinstance() 
with empty tuple.

--
nosy: +serhiy.storchaka
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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29634
pull_request: https://github.com/python/cpython/pull/31507

___
Python tracker 

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 11.0 -> 12.0
pull_requests: +29633
pull_request: https://github.com/python/cpython/pull/31506

___
Python tracker 

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-22 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset bba8008f99d615a02984422a3825082bb5621f5a by vidhya in branch 
'main':
bpo-20923 : [doc] Explain ConfigParser 'valid section name'  and .SECTCRE 
(GH-31413)
https://github.com/python/cpython/commit/bba8008f99d615a02984422a3825082bb5621f5a


--

___
Python tracker 

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



[issue36557] [doc] Clarify the meaning of /uninstall in windows cli

2022-02-22 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you @slateny.

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



[issue36557] [doc] Clarify the meaning of /uninstall in windows cli

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset aa9a5c4d72e083f8b4c635d79f7450dbe8319469 by Miss Islington (bot) 
in branch '3.9':
bpo-36557: Updated wording for using/windows (GH-31457)
https://github.com/python/cpython/commit/aa9a5c4d72e083f8b4c635d79f7450dbe8319469


--

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Zachary Ware


Zachary Ware  added the comment:

But `suppress` takes varargs; from `suppress`'s perspective, there is no 
difference between `suppress()` and `l=[];suppress(*l)`.  There would be a 
difference at the AST level, but trying to find it within `suppress` to issue a 
warning seems unfeasible.  Certainly possible for a linter, though :)

--

___
Python tracker 

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



[issue46800] Support for pause(2)

2022-02-22 Thread Zachary Ware


Change by Zachary Ware :


--
resolution:  -> works for me
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



[issue36557] [doc] Clarify the meaning of /uninstall in windows cli

2022-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset d04fb9213a547def5604fbc60b0554c176d4c998 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-36557: Updated wording for using/windows (GH-31457) (GH-31504)
https://github.com/python/cpython/commit/d04fb9213a547def5604fbc60b0554c176d4c998


--

___
Python tracker 

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



  1   2   >