[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-08 Thread Alex Waygood


Alex Waygood  added the comment:

Please try to make your messages more concise.

--

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



[issue47250] New object.__getstate__() method introduced refleaks

2022-04-07 Thread Alex Waygood


Change by Alex Waygood :


--
title: Add object.__getstate__() introduced refleaks -> New 
object.__getstate__() method introduced refleaks

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



[issue47237] Inheritance from Protocol with property in dataclass makes them non-instantiatable

2022-04-06 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, JelleZijlstra, eric.smith, gvanrossum, kj

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



[issue46134] Confusing error message for AttributeError with dataclasses

2022-04-05 Thread Alex Waygood


Alex Waygood  added the comment:

Closing due to lack of response from OP.

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

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



[issue47212] Minor issues in reported Syntax errors

2022-04-05 Thread Alex Waygood


Change by Alex Waygood :


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

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



[issue47050] Cannot install Python 3.10.3 on Windows

2022-04-05 Thread Alex Waygood


Alex Waygood  added the comment:

(My solution for now has been to install python on my other laptop. Thanks for 
the help Steve!)

--
stage:  -> resolved
status: open -> closed

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



[issue47097] Document PEP 646

2022-04-04 Thread Alex Waygood


Alex Waygood  added the comment:

(Feel free to reopen this issue if there's more to be done, Matthew!)

--

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



[issue47097] Document PEP 646

2022-04-04 Thread Alex Waygood


Change by Alex Waygood :


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

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



[issue47213] Incorrect location of caret in SyntaxError

2022-04-04 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +pablogsal
title: arrow at wrong place -> Incorrect location of caret in SyntaxError
type: enhancement -> behavior

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



[issue47166] Dataclass transform should ignore TypeAlias variables

2022-03-31 Thread Alex Waygood


Alex Waygood  added the comment:

I think implementing this would add complexity to the code in dataclasses.py 
(though Eric's the expert!).

For your use case, is it essential that the type alias declaration be inside 
the class scope? Would it be possible for you to simply have the alias 
declaration in the global scope instead?

--

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



[issue47105] [Doc] grp cites pwd.h instead of grp.h

2022-03-23 Thread Alex Hedges


Change by Alex Hedges :


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

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



[issue47105] [Doc] grp cites pwd.h instead of grp.h

2022-03-23 Thread Alex Hedges


New submission from Alex Hedges :

The documentation page for the grp module says to "see ", even though 
the source code 
(https://github.com/python/cpython/blob/v3.11.0a6/Modules/grpmodule.c) uses 
grp.h.

I plan to release a PR for this shortly.

--
assignee: docs@python
components: Documentation
messages: 415924
nosy: aphedges, docs@python
priority: normal
severity: normal
status: open
title: [Doc] grp cites pwd.h instead of grp.h
versions: Python 3.11

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



[issue46769] Improve documentation for `typing.TypeVar`

2022-03-23 Thread Alex Waygood

Alex Waygood  added the comment:

Thanks Guido for your insight, and Jelle/Łukasz for the reviews and backports!

I'm on holiday right now, but when I'm back, I'll take a look at maybe 
proposing some minor revisions to PEP 484 as well, as Guido suggests.

--

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



[issue47073] Solution for recursion error when comparing dataclass objects

2022-03-20 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +eric.smith

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2022-03-20 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, JelleZijlstra

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



[issue47067] Add vectorcall for generica alias object

2022-03-20 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +JelleZijlstra, gvanrossum, kj

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



[issue32927] Add typeshed documentation for unittest.TestCase._feedErrorsToResult and ._outcome

2022-03-20 Thread Alex Waygood


Alex Waygood  added the comment:

Typeshed maintainer here: I agree. Feel free to open an issue over at 
https://github.com/python/typeshed if this is still a problem!

--
nosy: +AlexWaygood
resolution:  -> third party
stage:  -> resolved
status: pending -> closed

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



[issue433030] SRE: Atomic Grouping (?>...) is not supported

2022-03-19 Thread Alex Waygood


Change by Alex Waygood :


--
versions: +Python 3.11 -Python 3.5

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



[issue31552] IDLE: Convert browsers to use ttk.Treeview

2022-03-19 Thread Alex Waygood


Change by Alex Waygood :


--
title: IDLE: Convert browswers to use ttk.Treeview -> IDLE: Convert browsers to 
use ttk.Treeview

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



[issue47022] PEP 594: Document removal of asynchat, asyncore and smtpd

2022-03-18 Thread Alex Waygood


Change by Alex Waygood :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage: patch review -> backport needed
versions: +Python 3.10, Python 3.9

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



[issue47050] Cannot install Python 3.10.3 on Windows

2022-03-17 Thread Alex Waygood


Alex Waygood  added the comment:

Hmm, well if I try running the 3.10.2 installer, it now presents me with an 
error message saying that "a newer version of Python 3.10 is already installed".

--

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



[issue47050] Cannot install Python 3.10.3 on Windows

2022-03-17 Thread Alex Waygood


Alex Waygood  added the comment:

> Looks like you may have "cleaned up" your package cache at some point, which 
> means you can't uninstall the old version anymore.

Not knowingly!

> Try getting the 3.10.2 installer and running it directly.

Thanks, I'll have a go.

--

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



[issue47050] Cannot install Python 3.10.3 on Windows

2022-03-17 Thread Alex Waygood


Alex Waygood  added the comment:

Attaching the log file from the installation.

--
Added file: https://bugs.python.org/file50687/installer_log_file.txt

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



[issue47050] Cannot install Python 3.10.3 on Windows

2022-03-17 Thread Alex Waygood


New submission from Alex Waygood :

I have tried several times now to upgrade to Python 3.10.3 using the 64-bit 
installer for Windows at https://www.python.org/downloads/release/python-3103/. 
Each time, I encounter an error message stating that "The feature you are 
trying to use is on a network resource that is unavailable". Further error 
messages include statements that "The older version of Python 3.10.3 Test Suite 
(64-bit) cannot be removed", and finally, "0x80070643 - Fatal error during 
installation".

Screenshots of the full error messages are attached.

Hardware details:
- Microsoft Windows 10 Home, Version 10.0.19043 Build 19043
- A x64-based PC
- An HP Pavilion Notebook laptop
- Processor AMD A8-7410 APU

Does anybody have any idea what might be going wrong?

I initially tried installing Python 3.10.3 with 3.10.2 still installed, but 
have now uninstalled Python 3.10.2 from my machine. It has made no difference.

--
components: Windows
files: error_messages-compressed.pdf
messages: 415438
nosy: AlexWaygood, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Cannot install Python 3.10.3 on Windows
versions: Python 3.10
Added file: https://bugs.python.org/file50686/error_messages-compressed.pdf

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



[issue46769] Improve documentation for `typing.TypeVar`

2022-03-16 Thread Alex Waygood


Change by Alex Waygood :


--
pull_requests: +30031
pull_request: https://github.com/python/cpython/pull/31941

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



[issue47015] Update tests from asyncore to asyncio

2022-03-14 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +asvetlov, giampaolo.rodola, josiahcarlson, stutzbach, yselivanov

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



[issue43721] Documentation of property.{getter, setter, deleter} fails to mention that a *new* property is returned

2022-03-14 Thread Alex Waygood


Change by Alex Waygood :


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

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



[issue47016] Create a test verifying bundled pip and setuptools wheels

2022-03-14 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +ned.deily

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



[issue47006] PEP 646: Decide on substitution behavior

2022-03-13 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

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



[issue46961] Caching/interning of small ints sometimes fails

2022-03-13 Thread Alex Waygood


Change by Alex Waygood :


--
nosy:  -AlexWaygood

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



[issue46982] Error in the experts list

2022-03-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


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

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



[issue46198] Duplicate and unused code in tests

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood
nosy_count: 3.0 -> 4.0
pull_requests: +29902
pull_request: https://github.com/python/cpython/pull/31801

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra

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



[issue43224] Add support for PEP 646

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
stage: patch review -> backport needed

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



[issue46677] TypedDict docs are incomplete

2022-03-10 Thread Alex Waygood


Change by Alex Waygood :


--
stage: patch review -> backport needed

___
Python tracker 
<https://bugs.python.org/issue46677>
___
___
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-03-10 Thread Alex Grönholm

Alex Grönholm  added the comment:

Yeah, I'm still interested. I'll create a new BPO when I have something.

--

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Alex Waygood

Alex Waygood  added the comment:

I agree with Jelle — a valid protocol cannot inherit from a concrete type, and 
the whole point of NamedTuple is that it creates a tuple subclass (and tuple is 
obviously a concrete type).

--

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



[issue46967] Type union for except

2022-03-09 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, Jelle Zijlstra, gvanrossum, iritkatriel

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Alex Waygood


Alex Waygood  added the comment:

+1 for the more minimal changeset proposed in PR 31781. I've never felt a need 
for NamedTuple multiple inheritance other than with Generic, so wouldn't be 
opposed to restricting it only to Generic.

--

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



[issue46961] Caching/interning of small ints sometimes fails

2022-03-08 Thread Alex Waygood


Alex Waygood  added the comment:

I think this might be a duplicate of Issue46361?

--
nosy: +AlexWaygood

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread Alex Waygood

Alex Waygood  added the comment:

Thanks so much to Ken, Łukasz, Jelle, Guido, and everybody else who helped 
review these PRs!

--

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



[issue46769] Improve documentation for `typing.TypeVar`

2022-03-06 Thread Alex Waygood


Change by Alex Waygood :


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

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



[issue46938] dataclass __post_init__ recursion

2022-03-06 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +eric.smith

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Alex Waygood

Alex Waygood  added the comment:

I sense we'll have to agree to disagree on the usefulness of NamedTuples in the 
age of dataclasses :)

For me, I find the simplicity of the underlying idea behind namedtuples — 
"tuples with some properties bolted on" — very attractive. Yes, standard tuples 
are more performant, but it's great to have a tool in the arsenal that's 
essentially the same as a tuple (and is backwards-compatible with a tuple, for 
APIs that require a tuple), but can also, like dataclasses, be 
self-documenting. (You're right that DoneAndNotDoneFutures isn't a great 
example of this.)

But I agree that this shouldn't be a priority if it's hard to accomplish; and 
there'll certainly be no complaints from me if energy is invested into making 
dataclasses faster.

--

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +graingert

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Alex Waygood


Alex Waygood  added the comment:

Consider the typeshed stub for `concurrent.futures.DoneAndNotDoneFutures`. At 
runtime this is a `collections.namedtuple`, but in the stub, we need it to be 
generic to allow precise type inference. But we can't have a generic 
NamedTuple, so the stub is currently this:

```
class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]):
@property
def done(self) -> set[Future[_T]]: ...
@property
def not_done(self) -> set[Future[_T]]: ...
def __new__(_cls, done: set[Future[_T]], not_done: set[Future[_T]]) -> 
DoneAndNotDoneFutures[_T]: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, __i: SupportsIndex) -> set[Future[_T]]: ...
@overload
def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ...
```

Until two days ago, this stub actually had a bug: `done` and `not_done` were 
both given as writeable attributes, whereas they are read-only properties at 
runtime.

With generic NamedTuples, we could write the stub for the class far more simply 
(and more accurately) like this:

```
class DoneAndNotDoneFutures(NamedTuple, Generic[_T]):
done: set[Future[_T]]
not_done: set[Future[_T]]
```

And in code that actually needs to run at runtime, I frequently find it 
frustrating that I have to use dataclasses instead of NamedTuples if I want a 
simple class that just happens to be generic. dataclasses are great, but for 
small, lightweight classes, I prefer to use NamedTuples where possible. I often 
find that I don't need to use the full range of features dataclasses provide; 
and NamedTuples are often more performant than dataclasses, especially in cases 
where there's a lot of tuple unpacking.

--

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



[issue46930] Iterating over cls.__dict__ in classmethod causes RuntimeError when printing __annotations__

2022-03-05 Thread Alex Waygood


Change by Alex Waygood :


--
type: crash -> behavior
versions: +Python 3.11

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra

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



[issue44863] Allow TypedDict to inherit from Generics

2022-03-05 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra, sobolevn

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



[issue44863] Allow TypedDict to inherit from Generics

2022-03-05 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Alex Waygood


Alex Waygood  added the comment:

> Is there an actual use case that broke?

No, because this was never usable in the first place. But there are those who 
wish it were usable :)

--

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Alex Waygood


Alex Waygood  added the comment:

I actually have quite a few use cases for this feature. It's true that type 
checkers don't (yet) support it, but that doesn't mean that it should be 
disallowed at runtime. In fact, allowing it at runtime will surely give type  
checkers room to experiment with implementing this feature if it is requested 
by enough users. As it is, they are blocked from doing so.

--

___
Python tracker 
<https://bugs.python.org/issue43923>
___
___
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-03-05 Thread Alex Waygood


Alex Waygood  added the comment:

The latest plan sounds good to me. I have some Thoughts on the proposed API, 
but it will be easier to express those as part of a PR review. Looking forward 
to seeing the PR!

--

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



[issue5043] get_msvcr() returns None rather than []

2022-03-04 Thread Alex Zunegin


Alex Zunegin  added the comment:

This messes up building Cython extensions on MSYS2 and MINGW. Still here as of 
setuptools 60. 

There is no line 
```
return [] <<<<<<<<-
```
at the end. Adding it helps.

--
nosy: +gesserat

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



[issue19217] Calling assertEquals for moderately long list takes too long

2022-03-04 Thread Alex Waygood


Change by Alex Waygood :


--
keywords:  -easy

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-04 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra, gvanrossum, kj, sobolevn

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



[issue46902] Typo hint message for from-imports?

2022-03-02 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +pablogsal
versions:  -Python 3.10

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



[issue46876] Walrus operator not in help

2022-03-01 Thread Alex Waygood


Change by Alex Waygood :


--
status: open -> closed

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



[issue46876] Walrus operator not in help

2022-03-01 Thread Alex Waygood


Change by Alex Waygood :


--
status: pending -> open
superseder:  -> Assignment expression symbol (walrus) not in built-in help()

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



[issue46876] Walrus operator not in help

2022-03-01 Thread Alex Waygood


Alex Waygood  added the comment:

Thanks for the report! I think this is a duplicate of Issue37082.

--
nosy: +AlexWaygood
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> pending

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



[issue38854] Decorator with paren tokens in arguments breaks inspect.getsource

2022-02-28 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

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



[issue38854] Decorator with paren tokens in arguments breaks inspect.getsource

2022-02-28 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +yselivanov
versions:  -Python 3.7, Python 3.8

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



[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-27 Thread Alex Waygood

Alex Waygood  added the comment:

Hi Vidhya — @slateny submitted a PR for this issue only two days ago (you can 
see that it's linked to this BPO issue in the "Pull Requests" field). I think 
it would be good to wait until that has been reviewed before doing any work on 
a possible PR for this issue :)

If you'd like to help out with this issue, you'd of course be very welcome to 
submit a review for @slateny's patch.

--
nosy: +AlexWaygood

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior
versions:  -Python 3.7, Python 3.8

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Alex Waygood

Alex Waygood  added the comment:

I'm removing 3.7 and 3.8 from the "versions" field, since they're currently 
only accepting patches for security-related bugs. But thanks for testing on 
those versions as well — that's useful information!

--
components: +Library (Lib)
nosy: +AlexWaygood, yselivanov
type:  -> behavior
versions:  -Python 3.7, Python 3.8

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



[issue46851] Document multiprocessing.set_forkserver_preload

2022-02-24 Thread Alex Waygood


Alex Waygood  added the comment:

(3.7 and 3.8 are not accepting patches unless they relate to security issues, 
so I am removing them from the "versions" field.)

--
nosy: +AlexWaygood
versions:  -Python 3.7, Python 3.8

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



[issue46851] Document multiprocessing.set_forkserver_preload

2022-02-24 Thread Alex Waygood


Change by Alex Waygood :


--
nosy:  -AlexWaygood

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



[issue46846] functools.partial objects should set __signature__ and _annotations__

2022-02-24 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

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



[issue46847] functools.update_wrapper doesn't understand partial objects and annotations

2022-02-24 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, Jelle Zijlstra, sobolevn

___
Python tracker 
<https://bugs.python.org/issue46847>
___
___
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 
<https://bugs.python.org/issue45100>
___
___
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


Change by Alex Waygood :


--
nosy: +sobolevn

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



[issue46814] Documentation for constructing abstract base classes is misleading

2022-02-21 Thread Alex Waygood


Change by Alex Waygood :


--
title: Documentation for constructin abstract base classes is misleading -> 
Documentation for constructing abstract base classes is misleading

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



[issue46821] Introspection support for typing.overload

2022-02-21 Thread Alex Waygood


Alex Waygood  added the comment:

Discussion of similar ideas in Issue45100

--

___
Python tracker 
<https://bugs.python.org/issue46821>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

> I was under the impression that ExceptionGroup was somewhat backwards 
> compatible, in that you could still use `except CancelledError:` and it would 
> catch all the errors in the group. But, maybe I'm wrong, I've not seen the 
> documentation for the final feature yet, but that's the impression I got from 
> the PEP.

No, you need the new except* syntax for that.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

> But, if we are using nonces on the CancelledError to keep track, then only 1 
> context manager will know if it was themselves or not. This is exactly why 
> I'm proposing to use multiple CancelledErrors, so that every nonce is passed 
> to the handling code.

Raising multiple CancelledErrors is not the only way to accomplish this. We 
could store the nonces in a single CancelledError instead.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

> Propagating an ExceptionGroup where every exception can be inspected to see 
> if it was caused by this code or not still seems like the safe option to me 
> (and obviously still has the cancel count implicitly).

Note that this, too, causes backwards incompatible changes in cancellation 
behavior. Previously, when the task was cancelled twice, only one 
CancelledError was raised. Now it would raise a BaseExceptionGroup instead.

The current backward incompatible changes in cancellation behavior are already 
causing 10 tests to fail in the AnyIO test suite. I'm trying to find an 
alternate solution that does not break anything.

--

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



[issue46805] Add low level UDP socket functions to asyncio

2022-02-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

Yeah, my question was specific about the new functions, so I understood that a 
separate PR should add that to the all the relevant functions.

I have a different problem now however: the test suite is failing in CI but not 
locally. It's giving me NameError about a function used by existing tests but 
for some reason, it's not defined in the scope of the new test functions?!?

The proactor version of sock_recvfrom_into() is giving me quite a bit of 
trouble, as it seems to require heavy handed changes in _overlapped.c. 

I'm also not very successful in testing cases where sendto() would fill the 
kernel buffer and raise BlockingIOError. With TCP this is easy but with UDP 
near impossible to do in a controlled fashion in the test suite.

--

___
Python tracker 
<https://bugs.python.org/issue46805>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

> It looks more complicated -- the extra parameter needs to be passed around 
> via the task and then into the CancelledError exception.

It reduces overall complexity by making uncancellation unnecessary and 
restoring backwards compatibility.

> What use case do you have that cannot be solved by some variation of the 
> "cancel count" proposal?

I'm not sure I'm keeping proper track of the variations, but it seems it still 
relies on task uncancellation. But worse than that, (correct me if I'm wrong) 
it makes the innermost context manager handle the cancellation, even if it was 
requested by an outer one. If you have 3 nested "cancel scopes" and the task is 
cancelled once, how do you know which one of those context managers should 
handle the cancellation?

I'm not sure my proposal is a fix-all either, in its current form. Sure, it 
fixes the case where a full task cancellation would go unnoticed, but if two 
unrelated context managers trigger cancellation at the same time, only the 
first one would actually receive it. Perhaps then we need to raise a 
CancelledError separately for each scope? I'm not sure yet.

--

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



[issue46805] Add low level UDP socket functions to asyncio

2022-02-20 Thread Alex Grönholm

Change by Alex Grönholm :


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

___
Python tracker 
<https://bugs.python.org/issue46805>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

> Alex, the 'scope' argument can be added if it is really required. 
> I'm not sure if the nonce is unavoidable still.

What other generic solution is there? I've read your last few messages but 
didn't find an answer. There needs to be some way to avoid a whole-task 
cancellation being ignored when it happens after a cancel scope triggers a 
cancellation for itself. My proposal solves that problem, and I think it 
eliminates the need for un-cancellation or other backwards incompatible changes.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

Can I also get comments on my proposal for the "scope" parameter? Is there a 
use case it would not solve?

--

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



[issue46807] Wrong class __annotations__ when field name and type are equal

2022-02-20 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +Jelle Zijlstra

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



[issue46807] Wrong class __annotations__ when field name and type are equal

2022-02-20 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, larry

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



[issue46805] Add low level UDP socket functions to asyncio

2022-02-20 Thread Alex Grönholm

Alex Grönholm  added the comment:

One question: should I add the "flags" argument to the new functions? For some 
reason it's missing from the existing functions, so maybe I should add that in 
a separate PR?

--

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



[issue46805] Add low level UDP socket functions to asyncio

2022-02-20 Thread Alex Grönholm

New submission from Alex Grönholm :

The asyncio module currently has a number of low-level functions for working 
asynchronously with raw socket objects. Such functions for working with UDP 
sockets are, however, notably absent, and there is no workaround for this. You 
can of course use sock_receive() with UDP sockets but that would discard the 
sender address which is a showstopper problem. Also, having a send function 
that applies back pressure to the sender if the kernel buffer is full would 
also be prudent.

I will provide a PR if you're okay with this.
It would include the following functions:

* sock_sendto()
* sock_recvfrom()
* sock_recvfrom_into()

--
components: asyncio
messages: 413579
nosy: alex.gronholm, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add low level UDP socket functions to asyncio
type: enhancement
versions: Python 3.11

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



[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood


Change by Alex Waygood :


--
keywords:  -patch
nosy:  -AlexWaygood
stage: patch review -> 

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



[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood


Change by Alex Waygood :


--
pull_requests:  -29560

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



[issue46754] Improve Python Language Reference based on [Köhl 2020]

2022-02-18 Thread Alex Waygood


Change by Alex Waygood :


--
keywords: +patch
nosy: +AlexWaygood
nosy_count: 1.0 -> 2.0
pull_requests: +29560
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29479

___
Python tracker 
<https://bugs.python.org/issue46754>
___
___
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-18 Thread Alex Grönholm

Alex Grönholm  added the comment:

I propose the following, backwards compatible solution:

Add a new keyword argument to Task.cancel(): "scope: object = None".
The behavior would be as follows: the scope is saved, and included in the 
raised CancelledError. If Task.cancel() is called again, but with scope=None 
(the default), it clears out the saved scope, if any. Any other scope will be 
ignored.

This simple change would allow for proper implementation of any context manager 
that needs to swallow or transform a CancelledError raised in the task.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-18 Thread Alex Grönholm

Alex Grönholm  added the comment:

I am also uncomfortable using the cancel message to deliver the 
token/nonce/whatever.

If TaskGroup.cancel() is implemented, would it also deliver a cancellation in 
the parent task like trio and AnyIO do? It should IMHO, because otherwise if 
the task group is cancelled, it could still get stuck waiting on whatever the 
parent task happens to be waiting on, if it's not at TaskGroup.__aexit__() yet.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-17 Thread Alex Grönholm

Alex Grönholm  added the comment:

@Guido you asked for the AnyIO implementation of Happy Eyeballs; here it is: 
https://github.com/agronholm/anyio/blob/ac3e7c619913bd0ddf9c36b6e633b278d07405b7/src/anyio/_core/_sockets.py#L85

(I didn't paste the actual code here because it's way too long)

--

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



[issue46774] Importlib.metadata.version picks first distribution not latest

2022-02-17 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +jaraco

___
Python tracker 
<https://bugs.python.org/issue46774>
___
___
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-16 Thread Alex Grönholm

Alex Grönholm  added the comment:

I just tried to write a snippet to demonstrate the issue in TaskGroup, but that 
doesn't seem possible since TaskGroup never swallows a CancelledError. It 
always raises/propagates _some_ exception out of __aexit__() unless of course 
all the child tasks run to completion successfully.

I was also surprised to notice that TaskGroup doesn't have a .cancel() method, 
so in cases where one would launch multiple tasks and cancel the rest when one 
succeeds, one would have to store all the child tasks separately and then 
iterate over them and cancel one by one. The Happy Eyeballs algorithm is one 
such use case (also used in AnyIO this way).

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-16 Thread Alex Grönholm

Alex Grönholm  added the comment:

Thanks, I will take a look at .uncancel() and .cancelling(). I saw that work 
happening in my email feed but couldn't figure out right away how it helped, 
but I will definitely look into the new TaskGroup code to see how it's used 
there and will get back to you after that.

--

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-16 Thread Alex Grönholm

Alex Grönholm  added the comment:

I'm not trying to argue that asyncio should be changed to have level 
cancellation or even cancel scopes as built-in (at this point), but expanding 
the low level API to make implementing these features possible in third party 
libraries without the awkward hacks we have now.

As for async-timeout, it suffers from the same problem as AnyIO and Quattro: 
that cancellations of the entire task can be inadvertently swallowed by the 
async context manager in edge cases. I hadn't even thought of the possibility 
of this happening until one of AnyIO's users reported just such a problem: 
https://github.com/agronholm/anyio/issues/374

I just couldn't think of any way to correctly support such things without at 
least _some_ changes to the task cancellation behavior, and allowing .cancel() 
to update the cancel message seemed like the least invasive option. I'm all 
ears if someone has a better solution.

--
nosy:  -ajoino

___
Python tracker 
<https://bugs.python.org/issue46771>
___
___
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-16 Thread Alex Grönholm

Alex Grönholm  added the comment:

A brief explanation of cancel scopes for the uninitiated: A cancel scope can 
enclose just a part of a coroutine function, or an entire group of tasks. They 
can be nested within each other (by using them as context managers), and marked 
as shielded from cancellation, which means cancellation won't be propagated 
(i.e. raised in the coroutine function) from a cancelled outer scope until 
either the inner scope's shielding is disabled or the inner scope is exited or 
cancelled directly.

The fundamental problem in implementing these on top of asyncio is that native 
task cancellation can throw a wrench in these gears. Since a cancel scope works 
by catching a cancellation error and then (potentially) allowing the coroutine 
to proceed, it would have to know, when catching a cancellation error, if the 
cancellation error was targeted at a cancel scope or the task itself. A 
workaround for this, made possible in Python 3.9, is to (ab)use cancellation 
messages to include the ID of the target cancel scope. This only solves half of 
the problem, however. If the task is already pending a cancellation targeted at 
a cancel scope, the task itself cannot be cancelled anymore since calling 
cancel() again on the task is a no-op. This would be solved by updating the 
cancel message on the second call. The docs don't say anything about the 
behavior on the second call, so it's not strictly speaking a change in 
documented behavior.

Then, on the subject of level cancellation: level cancellation builds upon 
cancel scopes and changes cancellation behavior so that whenever a task yields 
while a cancelled cancel scope is in effect, it gets hit with a CancelledError 
every time, as opposed to just once in asyncio's "edge" style cancellation. 
Another very important difference is that with level cancellation, even a task 
that starts within a cancelled scope gets to run up until the first yield 
point. This gives it an opportunity to clean up any resources it was given 
ownership of (a connected socket in a socket server is a common, practical 
example of this).

This is what the asyncio documentation states about Task.cancel():

"This arranges for a CancelledError exception to be thrown into the wrapped 
coroutine on the next cycle of the event loop.

The coroutine then has a chance to clean up or even deny the request by 
suppressing the exception with a try … … except CancelledError … finally block. 
Therefore, unlike Future.cancel(), Task.cancel() does not guarantee that the 
Task will be cancelled, although suppressing cancellation completely is not 
common and is actively discouraged."

This is, however, only true for a task that has started running. A Task that 
gets cancelled before even entering the coroutine is silently dropped.

As asyncio does not allow for custom task instances without overriding the 
entire task factory, it leaves libraries like AnyIO some less desirable options 
for implementing level cancellation:

1. Implementing a parallel task system using low level synchronous callbacks 
(con: such tasks won't show up in asyncio.all_tasks() or work with third party 
debugging tools)
2. Adding callbacks to continuously cancel tasks that yield inside a cancelled 
scope (con: ugly; potentially extra overhead?)
3. Adding a wrapper for the task that acts as a "controller" (con: adds an 
extra visible stack frame, messes with the default task name)

Having low level machinery for injecting a custom Task instance to the event 
loop would probably solve this problem.

--
nosy: +alex.gronholm -tinchester

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



[issue46769] Improve documentation for `typing.TypeVar`

2022-02-16 Thread Alex Waygood


New submission from Alex Waygood :

There are three variants of `TypeVar`s:

(1) TypeVars that are neither constrained nor bound: `T = TypeVar("T")`
(2) TypeVars that are bound: `U = TypeVar("U", bound=str)`
(3) TypeVars that are constrained: `V = TypeVar("V", str, bytes)`

The third variant is important for annotating certain functions, such as those 
in the `re` module. However, it has a number of issues (see 
https://github.com/python/typing/discussions/1080 for further discussion):

(1) It has somewhat surprising semantics in many situations.
(2) It is difficult for type checkers to deal with, leading to a number of bugs 
in mypy, for example.
(3) Many users (especially people relatively inexperienced with Python typing) 
reach for constrained TypeVars in situations where using bound TypeVars or the 
@overload decorator would be more appropriate.

Both PEP 484 and the documentation for the typing module, however:

(1) Give examples for variants (1) and (3), but not for variant (2), which is 
treated as something of an afterthought.
(2) Do not mention that TypeVars can be bound to a union of types, which is an 
important point: `T = TypeVar("T", str, bytes)` has different semantics to `T = 
TypeVar("T", bound=str|bytes)`, and often the latter is more appropriate.

--
assignee: docs@python
components: Documentation
messages: 413342
nosy: AlexWaygood, Jelle Zijlstra, docs@python, gvanrossum, kj, sobolevn
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve documentation for `typing.TypeVar`
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue46764] Wrapping a bound method with a @classmethod no longer works

2022-02-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +rhettinger
type:  -> behavior

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



  1   2   3   4   5   6   7   8   9   10   >