[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2021-08-01 Thread Serhiy Storchaka
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

[issue44802] Substitution does not work after ParamSpec substitution of the user generic with a list of TypeVars

2021-08-01 Thread Serhiy Storchaka
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")

[issue43596] change assertRaises message when wrong exception is raised

2021-08-01 Thread Serhiy Storchaka
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

[issue44801] Type expression is coerced to a list of parameter arguments in substitution of ParamSpec

2021-08-01 Thread Serhiy Storchaka
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

[issue44801] Type expression is coerced to a list of parameter arguments in substitution of ParamSpec

2021-08-01 Thread Serhiy Storchaka
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,

[issue43468] functools.cached_property incorrectly locks the entire descriptor on class instead of per-instance locking

2021-08-01 Thread Serhiy Storchaka
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

[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka
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

[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka
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

[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka
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 ... >>>

[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- Removed message: https://bugs.python.org/msg398655 ___ Python tracker <https://bugs.python.org/issue44796> ___ ___ Python-bug

[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka
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 ... >>>

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- Removed message: https://bugs.python.org/msg398654 ___ Python tracker <https://bugs.python.org/issue44794> ___ ___ Python-bug

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
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 ... >>>

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44098] Remove ParamSpec from __parameters__ of most typing generics

2021-07-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See issue44796. -- ___ Python tracker <https://bugs.python.org/issue44098> ___ ___ Python-bugs-list mailing list Unsub

[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka
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

[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- dependencies: +Merge tests for typing.Callable and collection.abc.Callable ___ Python tracker <https://bugs.python.org/issue44

[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka
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

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka
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

[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka
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

[issue44773] case_insensitive kwarg in str.replace()

2021-07-30 Thread Serhiy Storchaka
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

[issue44098] Remove ParamSpec from __parameters__ of most typing generics

2021-07-27 Thread Serhiy Storchaka
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

[issue44098] Remove ParamSpec from __parameters__ of most typing generics

2021-07-27 Thread Serhiy Storchaka
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

[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2021-07-27 Thread Serhiy Storchaka
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 ___

[issue44739] Tkinter text horizontal scrollbar is not stationary

2021-07-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> third party ___ Python tracker <https://bugs.python.org/issue44739> ___ ___ Python-bugs-list mailing list Un

[issue44746] Improper behaviour of 'finally' keyword

2021-07-27 Thread Serhiy Storchaka
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

[issue41203] Replace references to OS X in documentation with macOS

2021-07-25 Thread Serhiy Storchaka
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

[issue41203] Replace references to OS X in documentation with macOS

2021-07-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue41203> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Serhiy Storchaka
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Serhiy Storchaka
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Interpreter Core, Library (Lib) versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue44

[issue44732] Rename types.Union to types.UnionType

2021-07-24 Thread Serhiy Storchaka
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Serhiy Storchaka
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Serhiy Storchaka
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

[issue44731] Simplify implementation of the union type

2021-07-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It fixes also issue44642. -- ___ Python tracker <https://bugs.python.org/issue44731> ___ ___ Python-bugs-list mailin

[issue44353] PEP 604 NewType

2021-07-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25864 pull_request: https://github.com/python/cpython/pull/9951 ___ Python tracker <https://bugs.python.org/issue44

[issue44731] Simplify implementation of the union type

2021-07-24 Thread Serhiy Storchaka
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

[issue44731] Simplify implementation of the union type

2021-07-24 Thread Serhiy Storchaka
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

[issue44721] Problem in tkinter button widget

2021-07-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug ___ Python tracker <https://bugs.python.org/issue44721> ___ ___ Python-bugs-list mailing list Un

[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-07-23 Thread Serhiy Storchaka
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

[issue44353] PEP 604 NewType

2021-07-23 Thread Serhiy Storchaka
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

[issue44353] PEP 604 NewType

2021-07-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25856 pull_request: https://github.com/python/cpython/pull/27311 ___ Python tracker <https://bugs.python.org/issue44

[issue44353] PEP 604 NewType

2021-07-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue44353> ___ ___ Python-bugs-list mailing list Unsub

[issue43838] There is a way to access an underlying mapping in MappingProxyType

2021-07-23 Thread Serhiy Storchaka
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

[issue44711] Optimize type check in pipes.py

2021-07-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue44712. -- ___ Python tracker <https://bugs.python.org/issue44711> ___ ___ Python-bugs-list mailing list Unsub

[issue44712] Replace `type(literal)` with corresponding builtin types

2021-07-22 Thread Serhiy Storchaka
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

[issue44712] Replace `type(literal)` with corresponding builtin types

2021-07-22 Thread Serhiy Storchaka
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

[issue44712] Replace `type(literal)` with corresponding builtin types

2021-07-22 Thread Serhiy Storchaka
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

[issue44711] Optimize type check in pipes.py

2021-07-22 Thread Serhiy Storchaka
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

[issue44707] runtime error: applying zero offset to null pointer in Objects/listobject.c

2021-07-22 Thread Serhiy Storchaka
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

[issue44707] runtime error: applying zero offset to null pointer in Objects/listobject.c

2021-07-22 Thread Serhiy Storchaka
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

[issue44710] Unexpected behavior in empty class with pass (Python 3.7.3)

2021-07-22 Thread Serhiy Storchaka
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

[issue44706] UUID constructor should accept another UUID instance

2021-07-22 Thread Serhiy Storchaka
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? __

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Serhiy Storchaka
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]]

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25795 pull_request: https://github.com/python/cpython/pull/27247 ___ Python tracker <https://bugs.python.org/issue44

[issue44668] More differences in instance and subclass checks between typing.Union and types.Union

2021-07-19 Thread Serhiy Storchaka
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

[issue44668] More differences in instance and subclass checks between typing.Union and types.Union

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Library (Lib) type: -> behavior versions: +Python 3.10, Python 3.11 ___ Python tracker <https://bugs.python.org/issu

[issue44668] More differences in instance and subclass checks between typing.Union and types.Union

2021-07-18 Thread Serhiy Storchaka
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

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25780 pull_request: https://github.com/python/cpython/pull/27232 ___ Python tracker <https://bugs.python.org/issue44

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -25757 ___ Python tracker <https://bugs.python.org/issue44653> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44654] Refactor and clean up the union type implementation

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44654] Refactor and clean up the union type implementation

2021-07-18 Thread Serhiy Storchaka
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

[issue44633] Indexing the union type can return NotImplemented

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44654] Refactor and clean up the union type implementation

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25766 pull_request: https://github.com/python/cpython/pull/27225 ___ Python tracker <https://bugs.python.org/issue44

[issue44654] Refactor and clean up the union type implementation

2021-07-18 Thread Serhiy Storchaka
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

[issue44633] Indexing the union type can return NotImplemented

2021-07-18 Thread Serhiy Storchaka
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

[issue44664] builtins.chr and the 'c' format flag raise different errors

2021-07-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is there any example where it causes troubles? -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue44

[issue44633] Indexing the union type can return NotImplemented

2021-07-18 Thread Serhiy Storchaka
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

[issue44654] Refactor and clean up the union type implementation

2021-07-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25764 pull_request: https://github.com/python/cpython/pull/27223 ___ Python tracker <https://bugs.python.org/issue44

[issue44654] Refactor and clean up the union type implementation

2021-07-17 Thread Serhiy Storchaka
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

[issue44654] Refactor and clean up the union type implementation

2021-07-17 Thread Serhiy Storchaka
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

[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-17 Thread Serhiy Storchaka
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

[issue44633] Indexing the union type can return NotImplemented

2021-07-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -25756 ___ Python tracker <https://bugs.python.org/issue44633> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44633] Indexing the union type can return NotImplemented

2021-07-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25759 pull_request: https://github.com/python/cpython/pull/27218 ___ Python tracker <https://bugs.python.org/issue44

[issue44633] Indexing the union type can return NotImplemented

2021-07-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -25744 ___ Python tracker <https://bugs.python.org/issue44633> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -25745 ___ Python tracker <https://bugs.python.org/issue44653> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-17 Thread Serhiy Storchaka
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

[issue44659] Remove Ivan from list of typing experts

2021-07-16 Thread Serhiy Storchaka
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

[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka
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

[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka
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

[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka
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

[issue44633] Indexing the union type can return NotImplemented

2021-07-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Expected raising a TypeError. -- ___ Python tracker <https://bugs.python.org/issue44633> ___ ___ Python-bugs-list mailin

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-16 Thread Serhiy Storchaka
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

[issue44652] Preserve natural order of args in the union type

2021-07-16 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25726 pull_request: https://github.com/python/cpython/pull/27190 ___ Python tracker <https://bugs.python.org/issue44

[issue44652] Preserve natural order of args in the union type

2021-07-16 Thread Serhiy Storchaka
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

[issue44636] It is possible to create a 1-type union type

2021-07-16 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44636] It is possible to create a 1-type union type

2021-07-16 Thread Serhiy Storchaka
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

[issue44652] Preserve natural order of args in the union type

2021-07-16 Thread Serhiy Storchaka
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

[issue44652] Preserve natural order of args in the union type

2021-07-16 Thread Serhiy Storchaka
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) >>

[issue44636] It is possible to create a 1-type union type

2021-07-16 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +25718 pull_request: https://github.com/python/cpython/pull/27181 ___ Python tracker <https://bugs.python.org/issue44

[issue44636] It is possible to create a 1-type union type

2021-07-16 Thread Serhiy Storchaka
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

[issue44646] hash() of the unity type is not consistent with equality

2021-07-16 Thread Serhiy Storchaka
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

[issue44636] It is possible to create a 1-type union type

2021-07-16 Thread Serhiy Storchaka
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

[issue44651] An unclear definition in Doc/glossary.rst

2021-07-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +mark.dickinson ___ Python tracker <https://bugs.python.org/issue44651> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44642] Union of a type and the typing module function

2021-07-15 Thread Serhiy Storchaka
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

<    8   9   10   11   12   13   14   15   16   17   >