[issue44822] [sqlite3] Do not truncate results of user functions and aggregates on the first NUL

2021-08-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- title: [sqlite3] Micro-optimisation: pass string size to sqlite3_result_text() -> [sqlite3] Do not truncate results of user functions and aggregates on the first NUL type: enhancement -> behavior versions: +Python 3.10, Pyth

[issue44822] [sqlite3] Micro-optimisation: pass string size to sqlite3_result_text()

2021-08-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The difference between specifying negative and non-negative third argument of sqlite3_result_text() is that in the latter case the result can contain embedded NUL characters. Could you please add a test for string containing embedded NUL? Letting SQLite

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

2021-08-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +26088 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27585 ___ Python tracker <https://bugs.python.org/issu

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

2021-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Ken Jin. So the problem is the __args__ (x, str) is interpreted differently depending on x, and after substituting x the interpretation can be changed. If x was ParamSpec, it was interpreted in one way, but if it becomes int, it is now

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

2021-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > It should use "(id(instance), instance)" rather than just "instance" as the > key. It should use a dict with id(instance) as a key and instance as value. An instance can be non-hashable. --

[issue44818] '\t' (tab) support

2021-08-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue44818> ___ ___ Python-bugs-list mailing list Un

[issue20703] RuntimeError caused by lazy imports in pdb

2021-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: My concern about importing readline at the top of the module is that importing readline has a side effect. The only module which imports it unconditionally at the top is rlcompleter. In all other places it is imported lazily. And importing readline ahead

[issue34782] Pdb raises exception when code is executed in a mapping that does not define `__contains__`

2021-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You cannot expect that running code under debugger does not have any effect. Otherwise there would not be any meaning in debugger. Running code under debugger has some side effects, and setting locals __return__ and __exception__ is one of them

[issue44806] Subclassing Protocol get different __init__

2021-08-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is other related case: >>> from typing import * >>> class P(Protocol): pass ... >>> class B: ... def __init__(self): ... self.test = 'OK' ... >>> class D(P, B): ... pass ... >>> D().t

[issue44806] Subclassing Protocol get different __init__

2021-08-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +26054 pull_request: https://github.com/python/cpython/pull/27545 ___ Python tracker <https://bugs.python.org/issue44

[issue44806] Subclassing Protocol get different __init__

2021-08-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka versions: +Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue44806> ___ ___ Pytho

[issue44793] Arguments ignored in substitution in typing.Callable

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

[issue44785] test_pickle issues "DeprecationWarning: The Tix Tk.."

2021-08-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka nosy_count: 2.0 -> 3.0 pull_requests: +26048 pull_request: https://github.com/python/cpython/pull/27538 ___ Python tracker <https://bugs.python.org/issu

[issue44793] Arguments ignored in substitution in typing.Callable

2021-08-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f92b9133ef67e77605cbd315b6b6c81036ce110e by Serhiy Storchaka in branch 'main': bpo-44793: Fix checking the number of arguments when subscribe a generic type with ParamSpec parameter. (GH-27515) https://github.com/python/cpython/commit

[issue44804] Port fix of "issue44422" to Python3.6.x

2021-08-02 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +ned.deily ___ Python tracker <https://bugs.python.org/issue44804> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20703] RuntimeError caused by lazy imports in pdb

2021-08-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Having a side effect at import time is not good. It will interfere with programs which just import pdb, but not use it. There are two other options: 1. Import readline at top level, but call set_completer_delims() lazily. 2. Do not import readline at all

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

2021-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 27528 makes the C implementation of OrderedDict.popitem() consistent with the Python implementation (do not call overridden __getitem__ and __setitem__). PR 27530 changes also both implementations of OrderedDict.pop(). It simplifies the C code

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

2021-08-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +26045 pull_request: https://github.com/python/cpython/pull/27530 ___ Python tracker <https://bugs.python.org/issue27

[issue41973] Docs: TypedDict is now of type function instead of class

2021-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually most names defined in typing are no longer classes. -- assignee: -> docs@python components: +Documentation nosy: +docs@python, gvanrossum, kj versions: +Python 3.11 ___ Python tracker <

[issue41973] Docs: TypedDict is now of type function instead of class

2021-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: TypeDict is a callable, it can be used as Point2D = TypedDict('Point2D', x=int, y=int, label=str) It can also be used as a base in class definition, but is is not a class itself. It does not occur in __bases__ of the created class, and it cannot

[issue44782] LRU class given as example in OrderedDict docs not work on pop

2021-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree that composition is methodologically more correct than inheritance for implementing a variant of lru_cache(). But if you need lru_cache() why not use lru_cache() from the stdlib? I think that instead of showing a poor version of the lru_cache

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

2021-08-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +26043 pull_request: https://github.com/python/cpython/pull/27528 ___ Python tracker <https://bugs.python.org/issue27

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

2021-08-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is complicated. The pure Python implementation of OrderedDict.popitem() and OrderedDict.pop() are not consistent. The former uses dict.pop() which doesn't call __getitem__ and __setitem__. The latter calls __getitem__ and __setitem__. The C

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

2021-08-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue27

[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

  1   2   3   4   5   6   7   8   9   10   >