Serhiy Storchaka added the comment:
It was reverted because it did not keep the C version in harmony with the pure
Python version. In the pure Python version pop() calls __getitem__ and
__delitem__ which can be overridden in subclasses of OrederedDict. My patch
always called dict
New submission from Serhiy Storchaka :
If the user generic with ParamSpec parameter substituted with a parametrised
list containing TypeVar, that TypeVar cannot be substituted.
>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
Serhiy Storchaka added the comment:
I concur with Irit. The test is failed in any case, so you need to look at the
code to fix it.
For the same reason we do not have assertNotRaises().
--
nosy: +serhiy.storchaka
___
Python tracker
<ht
Change by Serhiy Storchaka :
--
components: +Library (Lib)
dependencies: +Arguments ignored in substitution in typing.Callable
type: -> behavior
versions: +Python 3.10, Python 3.11
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
Type expression is coerced to a list of parameter arguments in substitution of
ParamSpec. For example:
>>> from typing import *
>>> T = TypeVar('T')
>>> P = ParamSpec('P')
>>> C = Callable[P, T]
>>> C[int,
Serhiy Storchaka added the comment:
I think it was a mistake to use lock in cached_property at first place. In most
cases there is nothing wrong in evaluating the cached value more than once.
lru_cache() does not use a lock for calling the wrapped function, and it works
well. The only lock
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +26033
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27518
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
My understanding is that type expression is valid when substitute TypeVar and
parameters expression is valid when substitute ParamSpec.
--
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
There is also similar bug in Generic:
>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
...
>>>
Change by Serhiy Storchaka :
--
Removed message: https://bugs.python.org/msg398655
___
Python tracker
<https://bugs.python.org/issue44796>
___
___
Python-bug
Serhiy Storchaka added the comment:
There is also similar bug in Generic:
>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
...
>>>
Change by Serhiy Storchaka :
--
Removed message: https://bugs.python.org/msg398654
___
Python tracker
<https://bugs.python.org/issue44794>
___
___
Python-bug
Serhiy Storchaka added the comment:
There is also similar bug in Generic:
>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
...
>>>
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +26030
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27515
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
New changeset be4cb9089aaf58d5f90da5f9fa66dc3c6763b5a2 by Serhiy Storchaka in
branch 'main':
bpo-44794: Merge tests for typing.Callable and collection.abc.Callable
(GH-27507)
https://github.com/python/cpython/commit
Serhiy Storchaka added the comment:
If Callable is nested, it works as expected:
>>> typing.List[C][int, str, float]
Traceback (most recent call last):
File "", line 1, in
File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
Serhiy Storchaka added the comment:
See issue44796.
--
___
Python tracker
<https://bugs.python.org/issue44098>
___
___
Python-bugs-list mailing list
Unsub
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +26025
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27511
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
dependencies: +Merge tests for typing.Callable and collection.abc.Callable
___
Python tracker
<https://bugs.python.org/issue44
New submission from Serhiy Storchaka :
Adding __parameters__ and __getitem__ in TypeVar and ParamSpec allows to
generalize and simplify the code (especially the C code) and allows to add more
runtime checks. It may open ways for further simplification.
Unfortunately it is not compatible
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +26021
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27507
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
The proposed PR merges tests for typing.Callable (in test_typing.py) and
collection.abc.Callable (in test_genericalias.py). All old tests are now
executed for both implementations.
It has exposed a bug in typing.Callable (see issue44793) and minor bug
New submission from Serhiy Storchaka :
>>> import typing
>>> T = typing.TypeVar('T')
>>> P = typing.ParamSpec('P')
>>> C = typing.Callable[P, T]
>>> C[int, str, float]
typing.Callable[[int], str]
int substitutes P as [int], str substitute
New submission from Serhiy Storchaka :
Substitution of ParamSpec in Concatenate produces weird results:
>>> import typing
>>> P = typing.ParamSpec('P')
>>> typing.Concatenate[str, P][int]
typing.Concatenate[str, int]
>>> typing.Concatenate[s
Serhiy Storchaka added the comment:
I concur with Raymond and Eric.
Note that in general case the problem is more complex that you may expect.
First, some characters can match two characters (e.g. 'ß' matches 'SS'), and
therefore indexes of characters are different in different cases. Second
Serhiy Storchaka added the comment:
I am writing a patch which generalizes and significantly simplifies the code
for type variables and parameter specifications substitution, and opens a way
for more runtime validation. But it is incompatible with these changes
Serhiy Storchaka added the comment:
I think that List[P] should be illegal at first place.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
It would be nice to add a multi-thread supporting version of tee() or add
multi-thread support in tee(), but this is different issue.
--
stage: patch review -> resolved
status: pending -> closed
___
Change by Serhiy Storchaka :
--
resolution: -> third party
___
Python tracker
<https://bugs.python.org/issue44739>
___
___
Python-bugs-list mailing list
Un
Serhiy Storchaka added the comment:
I cannot reproduce.
>>> try:
... 1/0
... except:
... print('except')
... raise
... finally:
... print('finally')
...
except
finally
Traceback (most recent call last):
File "", line 2, in
ZeroDivisionError: division
Serhiy Storchaka added the comment:
Patrick, are you interested in reviving your PR? It mostly LGTM, except several
not addressed comments. I clarified them.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue41
Change by Serhiy Storchaka :
--
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/issue41203>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
New changeset 0aea99e44416f37c75e5540072156dbf90ef1659 by Miss Islington (bot)
in branch '3.10':
bpo-44676: Serialize the union type using only public API (GH-27323) (GH-27340)
https://github.com/python/cpython/commit
Serhiy Storchaka added the comment:
New changeset 435a0334d341e5f8faed594d9f015746bb7845db by Serhiy Storchaka in
branch 'main':
bpo-44676: Serialize the union type using only public API (GH-27323)
https://github.com/python/cpython/commit/435a0334d341e5f8faed594d9f015746bb7845db
Change by Serhiy Storchaka :
--
components: +Interpreter Core, Library (Lib)
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue44
New submission from Serhiy Storchaka :
There are differences between typing.Union and types.Union:
* typing.Union is indexable, types.Union is not.
* types.Union is a class, typing.Union is not.
types.Union corresponds to typing._UnionGenericAlias, not typing.Union. It is
confusing
Change by Serhiy Storchaka :
--
pull_requests: +25867
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/27323
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
It is not good to use private method in pickle, because we will not be able to
get rid of it for backward compatibility. Why not use functools.reduce()?
--
nosy: +serhiy.storchaka
status: closed -> o
Serhiy Storchaka added the comment:
It fixes also issue44642.
--
___
Python tracker
<https://bugs.python.org/issue44731>
___
___
Python-bugs-list mailin
Change by Serhiy Storchaka :
--
pull_requests: +25864
pull_request: https://github.com/python/cpython/pull/9951
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25863
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27318
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
The proposed PR simplifies implementation of the union type by removing direct
support of typing types. It was not necessary because all these types implement
__or__ and __ror__ methods.
The only visible difference is that int | TypeVar() etc returns
Change by Serhiy Storchaka :
--
resolution: -> not a bug
___
Python tracker
<https://bugs.python.org/issue44721>
___
___
Python-bugs-list mailing list
Un
Serhiy Storchaka added the comment:
Currently deprecation warnings are emitted in test_typing:
$ ./python -m test test_typing
0:00:00 load avg: 3.38 Run tests sequentially
0:00:00 load avg: 3.38 [1/1] test_typing
/home/serhiy/py/cpython/Lib/test/test_typing.py:4657: DeprecationWarning
Serhiy Storchaka added the comment:
PR 27311 copies tests from PR 9951, adds support of nested NewTypes (with
__qualname__ containing multiple components) an makes them pickleable by name
as functions and classes.
--
___
Python tracker
<ht
Change by Serhiy Storchaka :
--
pull_requests: +25856
pull_request: https://github.com/python/cpython/pull/27311
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44353>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
For __or__ we need to copy the content of both mapping to the resulting mapping
in any case. We can implement it as {**self, **other}. We should not use the
copy() method because it is not a part of the Mapping interface.
For __eq__, no copying is needed
Serhiy Storchaka added the comment:
See also issue44712.
--
___
Python tracker
<https://bugs.python.org/issue44711>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
All cases was manually checked several times (with months passes between
checks). Several cases were preserved: when the name of built-in type
conflicted with the name of function parameter (in weakref.py), when the code
was used for testing type
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25837
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27294
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
There are several occurrences of type(literal) in the code of the stdlib where
literal is a literal of built-in type: '', 1, [], {}, etc. I suppose it is a
remnants of very old code written when str, int, list, dict, etc were functions
and not classes
Serhiy Storchaka added the comment:
I suppose it is a very old code written when str was a function, not a type
(thus using type('')) and builtin types were not subclassable (thus not using
isinstance()).
I once analyzed other similar cases in the stdlib. Seems it is time to revive
my old
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25835
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27292
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
AFAIK pointer arithmetic with NULL has undefined behavior. There is similar
case in list_slice().
--
components: +Interpreter Core
nosy: +mark.dickinson, serhiy.storchaka
type: -> compile error
versions: +Python 3.10, Python 3.11, Python
Serhiy Storchaka added the comment:
Because super().__init__(name, bases, nmspc) does not have any effect. Type is
created by the metaclass' __new__ method, and the __init__ method is virtually
no-op.
--
nosy: +serhiy.storchaka
___
Python tracker
Serhiy Storchaka added the comment:
It is a duplicate of issue32112.
--
nosy: +serhiy.storchaka
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Should uuid.UUID() accept another UUID() instance?
__
Serhiy Storchaka added the comment:
There is also problem with other typing types:
>>> (int | T)[typing.List]
Traceback (most recent call last):
File "", line 1, in
TypeError: Each union argument must be a type, got typing.List
>>> (int | T)[typing.List[int]]
Change by Serhiy Storchaka :
--
pull_requests: +25795
pull_request: https://github.com/python/cpython/pull/27247
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
It is easy to fix once we define the correct behavior in corner cases.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
components: +Library (Lib)
type: -> behavior
versions: +Python 3.10, Python 3.11
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
1. Checks for types.Union ignore any non-type args. Checks for typing.Union
require fail on first checked non-type (but it can short circuit).
>>> import typing
>>> T = typing.TypeVar('T')
>>> issubclass(int, int | T | str)
T
Change by Serhiy Storchaka :
--
pull_requests: +25780
pull_request: https://github.com/python/cpython/pull/27232
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
pull_requests: -25757
___
Python tracker
<https://bugs.python.org/issue44653>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset a6670cdf77aab2b1ee7be0b9df060dcac2a2dc48 by Serhiy Storchaka in
branch '3.10':
[3.10] bpo-44654: Do not export the union type related symbols (GH-27223).
(GH-27225)
https://github.com/python/cpython/commit
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
pull_requests: +25766
pull_request: https://github.com/python/cpython/pull/27225
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
New changeset 8f50f44592190b5a8cb115f0d58d577036e68308 by Serhiy Storchaka in
branch 'main':
bpo-44654: Do not export the union type related symbols (GH-27223)
https://github.com/python/cpython/commit/8f50f44592190b5a8cb115f0d58d577036e68308
Serhiy Storchaka added the comment:
New changeset 85b58292cf94de74d028053ac33a65f269f305cb by Miss Islington (bot)
in branch '3.10':
bpo-44633: Fix parameter substitution of the union type with wrong types.
(GH-27218) (GH-27224)
https://github.com/python/cpython/commit
Serhiy Storchaka added the comment:
Is there any example where it causes troubles?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
New changeset 3ea5332a4365bdd771286b3e9692495116e9ceef by Serhiy Storchaka in
branch 'main':
bpo-44633: Fix parameter substitution of the union type with wrong types.
(GH-27218)
https://github.com/python/cpython/commit
Change by Serhiy Storchaka :
--
pull_requests: +25764
pull_request: https://github.com/python/cpython/pull/27223
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
New changeset 03aad3049d1591c76a219dfe089e5367f88f167e by Miss Islington (bot)
in branch '3.10':
[3.10] bpo-44654: Refactor and clean up the union type implementation
(GH-27196) (GH-27219)
https://github.com/python/cpython/commit
Serhiy Storchaka added the comment:
New changeset 0fd27375cabd12e68a2f12cfeca11a2d5043429e by Serhiy Storchaka in
branch 'main':
bpo-44654: Refactor and clean up the union type implementation (GH-27196)
https://github.com/python/cpython/commit/0fd27375cabd12e68a2f12cfeca11a2d5043429e
Serhiy Storchaka added the comment:
New changeset 2d055ce13250a4074f66a945381a149a3cf8c46f by Serhiy Storchaka in
branch '3.10':
[3.10] bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)
(GH-27207)
https://github.com/python/cpython/commit
Change by Serhiy Storchaka :
--
pull_requests: -25756
___
Python tracker
<https://bugs.python.org/issue44633>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
pull_requests: +25759
pull_request: https://github.com/python/cpython/pull/27218
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
pull_requests: -25744
___
Python tracker
<https://bugs.python.org/issue44633>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
pull_requests: -25745
___
Python tracker
<https://bugs.python.org/issue44653>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
nosy_count: 8.0 -> 9.0
pull_requests: +25743
pull_request: https://github.com/python/cpython/pull/27207
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
title: Remove Ivan from list of,typing experts -> Remove Ivan from list of
typing experts
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
> Yeah I noticed it re-lookups __module__ unnecessarily multiple times for the
> same type.
Actually I thought about this change, but did not implement it. Because it does
not look performance critical, and future versions will likely do different
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25731
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27196
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
I started reviewing and rewriting Objects/unionobject.c several weeks ago. Some
discovered bugs were reported and fixed in separate issues: issue44606,
issue44632, issue44635, issue44636, issue44646, issue44652. Before fixing the
remaining bugs
Serhiy Storchaka added the comment:
Expected raising a TypeError.
--
___
Python tracker
<https://bugs.python.org/issue44633>
___
___
Python-bugs-list mailin
New submission from Serhiy Storchaka :
>>> import typing
>>> T = typing.TypeVar('T')
>>> (int | T)[typing.Union[str, list]]
NotImplemented
See also issue44633. But in this case the expected result is int | str | list
or typing.Union[init, str, list].
--
c
Change by Serhiy Storchaka :
--
pull_requests: +25726
pull_request: https://github.com/python/cpython/pull/27190
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
New changeset 0cd2d51aadcd2a0c0739a5df0a6235d64f35619e by Serhiy Storchaka in
branch 'main':
bpo-44652: Preserve natural order of args in the union type. (GH-27185)
https://github.com/python/cpython/commit/0cd2d51aadcd2a0c0739a5df0a6235d64f35619e
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset c3007ab3c6cb384203bac8aa64d89c4b42f671a1 by Serhiy Storchaka in
branch '3.10':
[3.10] bpo-44636: Collapse union of equal types (GH-27178) (GH-27181)
https://github.com/python/cpython/commit/c3007ab3c6cb384203bac8aa64d89c4b42f671a1
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25722
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27185
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
There are two issues related to the order of __args__ in typing.Union and the
union type.
1. Indexing typing.Union preserves the order of arguments, but it is not always
true when use the | operator.
>>> A = typing.NewType('A', str)
>>
Change by Serhiy Storchaka :
--
pull_requests: +25718
pull_request: https://github.com/python/cpython/pull/27181
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
New changeset d9f923280f204204f8703756aef4f655b579b4b8 by Serhiy Storchaka in
branch 'main':
bpo-44636: Collapse union of equal types (GH-27178)
https://github.com/python/cpython/commit/d9f923280f204204f8703756aef4f655b579b4b8
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25716
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27179
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25715
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27178
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue44651>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
It is only reminder that our test for NewType is arbitrary. And it is not
compatible with PR 9951. Possible solutions are:
1. Make NewType a class and add more strict test. Pro -- we can make arbitrary
repr, contra -- it has small negative effect
1201 - 1300 of 25750 matches
Mail list logo