[issue37319] Deprecate using random.randrange() with non-integers

2020-03-22 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18473 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19112 ___ Python tracker <https://bugs.python.org/issu

[issue37319] Deprecate using random.randrange() with non-integers

2020-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Many functions that accepts non-integer arguments (except float) and truncate them to integers emits a deprecation warning since 3.8 (see issue36048 and issue20092). They will be errors in 3.10 (see 37999

[issue37319] Deprecate using random.randrange() with non-integers

2020-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using index() simplifies the code. Adding deprecation warnings complicates it. The PR consists of two commits, look at the first one to see how the code can finally look. If you think that the deprecation is not needed, we can just keep the simplified

[issue37319] Deprecate using random.randrange() with non-integers

2020-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you are against deprecating this "feature", it should be at least documented and covered by tests. -- ___ Python tracker <https://bugs.python.o

[issue40046] Increase test coverage of the random module

2020-03-23 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : The propose test adds several tests for random module. Mainly tests for integer, sequence and iterable arguments. It also documents that randrange() accepts non-integers. -- assignee: docs@python components: Documentation, Tests messages: 364840

[issue40046] Increase test coverage of the random module

2020-03-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18475 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19114 ___ Python tracker <https://bugs.python.org/issu

[issue40046] Increase test coverage of the random module

2020-03-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is wrong with adding more tests? -- ___ Python tracker <https://bugs.python.org/issue40046> ___ ___ Python-bugs-list m

[issue40054] Allow formatted strings as docstrings

2020-03-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue40065] py39: remove deprecation note for xml.etree.cElementTree

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for catching this Fred. I am surprised that some code uses xml.etree.cElementTree without falling back to xml.etree.ElementTree. In Python 3 you can just use xml.etree.ElementTree, in Python 2 you have to fallback to the Python implementation

[issue40065] py39: remove deprecation note for xml.etree.cElementTree

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The common idiom is try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET -- ___ Python tracker <https://bugs.python.org/issue40

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please explain the difference between hypothetical TemporaryDirectory(delete=False) and simple mkdtemp()? -- ___ Python tracker <https://bugs.python.org/issue25

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, then I think there is nothing to do this. Compatibility with context manager protocol is not a goal if it does nothing on exit. In any case you can easy to make it in three lines: @contextmanager def mymkdtemp(): yield mkdtemp

[issue36543] Remove old-deprecated ElementTree features (part 2)

2020-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6467134307cf01802c9f1c0384d8acbebecbd400 by Miro HronĨok in branch 'master': bpo-36543: What's new: Document how to replace xml.etree.cElementTree (GH-19188) https://github.com/python/cpython/commit/6467134307cf01802c9f1c038

[issue38804] Regular Expression Denial of Service in http.cookiejar

2020-03-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +larry priority: normal -> release blocker versions: -Python 2.7, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issu

[issue15987] Provide a way to compare AST nodes for equality recursively

2020-03-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure that implementing a rich comparison of AST nodes is the right way. There are too much options (compare attributes or not, compare recursively or not, compare types or not) and __eq__ does not support options. In addition, it requires

[issue40098] dir() does not return the list of valid attributes for the object

2020-03-28 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Due to the difference in the code of __getattr__ and __dir__ for object and type dir() does not return the list of valid attributes for the object. It can return a name which is not a valid attribute and miss a name of the valid attribute. 1. It does

[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But the following class should not lead to unlimited memory consumption when create new instances: class C: count = 0 def __init__(self): count = self.__class__.count self.__class__.count = count + 1 setattr(self, f'a{

[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think the current behavior is a guard against such pitfall. If you allow to add new keys when not all other keys are set, you can end with sharing growing set of keys. -- ___ Python tracker <ht

[issue40117] __round__ doesn't behave well with return NotImplemented

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want to get a TypeError, raise a TypeError. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40046] Increase test coverage of the random module

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, of course. The PR adds new tests for different types of arguments which currently are accepted (so it would be a regression if they will no accepted in new releases or in alternate implementations) and for types which currently are not accepted for

[issue40114] support maxsize argument for lru_cache's user_function option

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can use lru_cache(maxsize=128, typed=False)(user_function). lru_cache should support a function as an argument on if it is a single positional argument, this is the purpose. So you can write @lru_cache def func(...): ... instead of @lru_cache

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If CO_FUTURE_DIVISION conflicts with PyCF_ALLOW_TOP_LEVEL_AWAIT, does not CO_ITERABLE_COROUTINE conflict with PyCF_SOURCE_IS_UTF8 and CO_ASYNC_GENERATOR with PyCF_DONT_IMPLY_DEDENT? -- ___ Python tracker

[issue39943] Meta: Clean up various issues in C internals

2020-03-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18593 pull_request: https://github.com/python/cpython/pull/19236 ___ Python tracker <https://bugs.python.org/issue39

[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: dis.findlabels() always worked with a byte code. And the docstring correctly describes this. I think this is a documentation issue. The documentation fix should be backported to all maintained Python versions. If you want to make dis.findlabels

[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Sam that we should keep compatibility with C++ in header files. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40098] dir() does not return the list of valid attributes for the object

2020-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 5. dir(module) does not contain module type attributes (in contrary to dir() for regular object). >>> import keyword >>> dir(keyword) ['__all__', '__builtins__', '__cached__', '__doc__', '

[issue39943] Meta: Clean up various issues in C internals

2020-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 2c003eff8fef430f1876adf88e466bcfcbd0cc9e by Serhiy Storchaka in branch 'master': bpo-39943: Clean up marshal.c. (GH-19236) https://github.com/python/cpython/commit/2c003eff8fef430f1876adf88e466b

[issue40129] Add test classes for custom __index__, __int__, __float__ and __complex__

2020-03-31 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : There are many tests for int-like objects (which implement custom __index__ or __int__ methods) in different files. There are less tests for float-like objects (with the __float__ method). There are even tests for complex-like (with the __complex__

[issue40129] Add test classes for custom __index__, __int__, __float__ and __complex__

2020-03-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18618 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19262 ___ Python tracker <https://bugs.python.org/issu

[issue40098] dir() does not return the list of valid attributes for the object

2020-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If using __class__ and __dict__ attribuites is a feature, it does not work for __getattr__(). I think it is confusing if __dir__() and __getattr__() are not consistent. I'll try to deal with unittes.mock and then will look how this will work with

[issue40130] Remove _PyUnicode_AsKind from private C API

2020-03-31 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : _PyUnicode_AsKind is exposed as private C API. It is only used in unicodeobject.c, where it is defined. Its name starts with an underscore, it is not documented and not included in PC/python3.def (therefore is not exported on Windows). Seems it is not

[issue40130] Remove _PyUnicode_AsKind from private C API

2020-03-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18622 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19265 ___ Python tracker <https://bugs.python.org/issu

[issue40130] Remove _PyUnicode_AsKind from private C API

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

[issue40130] Remove _PyUnicode_AsKind from private C API

2020-04-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 17b4733f2ff0a4abc06e8c745755c06fc32942dd by Serhiy Storchaka in branch 'master': bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265) https://github.com/python/cpython/commit/17b4733f2ff0a4abc06e8c745755c0

[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: AFAIK extern "C" only affects mangling of function names. Because of overloading in C++ you can have several functions with the same name, and to distinguish "int abs(int)" from "float abs(float)" the C++ compiler mangles f

[issue40122] The implementation and documentation of "dis.findlables" don't match

2020-04-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b74468e233a5137ff518e61eff65ca2d8833e38a by laike9m in branch 'master': bpo-40122: Updated documentation for dis.findlabels() (GH-19274) https://github.com/python/cpython/commit/b74468e233a5137ff518e61eff65ca

[issue40122] The implementation and documentation of "dis.findlables" don't match

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

[issue39943] Meta: Clean up various issues in C internals

2020-04-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18709 pull_request: https://github.com/python/cpython/pull/19345 ___ Python tracker <https://bugs.python.org/issue39

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that the current code is not correct. __exit__ should not be called if __enter__ is failed. If some __enter__ implementation calls other __enter__s it should manually call corresponding __exit__s. -- nosy: +michael.foord, ncoghlan

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18714 pull_request: https://github.com/python/cpython/pull/19351 ___ Python tracker <https://bugs.python.org/issue40

[issue40160] documentation example of os.walk should be less destructive

2020-04-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I do not think there is clearer example of topdown=False than recursive remove. If you think that this example is destructive, consider how destructive is any possible example for shutil.rmtree()! -- nosy: +serhiy.storchaka

[issue40176] unterminated string literal tokenization error messages could be better

2020-04-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It could be even better. Inside the tokenizer we know where the string literal starts and what quotes it uses. The line and the offset of the *start* of the literal can be set in a SyntaxError. -- nosy: +serhiy.storchaka

[issue40175] Add support for removing zip entry in ZipInfo

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of issue700858 and issue6818. -- ___ Python tracker <https://bugs.python.org/issue40175> ___ ___ Pytho

[issue40175] Add support for removing zip entry in ZipInfo

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There were other issues and discussions about this. The problem of removing a file from a ZIP archive is similar to the problem of removing a line from a file. It cannot be made efficiently, and it is not even always possible. In some cases it may be

[issue40178] Convert the remaining os funtions to Argument Clinic

2020-04-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : The proposed PR converts os.getgrouplist(), os.initgroups(), os.sendfile() and os.get_terminal_size() to Argument Clinic. -- components: Extension Modules messages: 365762 nosy: serhiy.storchaka priority: normal severity: normal status: open

[issue40178] Convert the remaining os funtions to Argument Clinic

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18722 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19360 ___ Python tracker <https://bugs.python.org/issu

[issue40178] Convert the remaining os funtions to Argument Clinic

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Argument Clinic nosy: +larry ___ Python tracker <https://bugs.python.org/issue40178> ___ ___ Python-bugs-list mailin

[issue40178] Convert the remaining os funtions to Argument Clinic

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problems which prevented their conversions before (in issue20170): 1. os.sendfile() had parameter names conflicting with Python keywords. Was solved in issue38378. 2. os.get_terminal_size() has an optional argument without default value. It was

[issue36517] typing.NamedTuple does not support mixins

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch nosy: +serhiy.storchaka nosy_count: 3.0 -> 4.0 pull_requests: +18725 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19363 ___ Python tracker <https://bugs.p

[issue40179] Argument Clinic incorretly translates #elif

2020-04-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : It converts #if A ... #elif B ... #else ... #endif into #if A ... #endif /* A */ #if B ... #endif /* B */ #if !B ... #endif /* !B */ The correct translation is: #if A

[issue40179] Argument Clinic incorretly translates #elif

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18726 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19364 ___ Python tracker <https://bugs.python.org/issu

[issue40179] Argument Clinic incorretly translates #elif

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18727 pull_request: https://github.com/python/cpython/pull/19360 ___ Python tracker <https://bugs.python.org/issue40

[issue36517] typing.NamedTuple does not support mixins

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset a94e6272f16381349dbed74cdb738ec8ae23b4fe by Serhiy Storchaka in branch 'master': bpo-36517: Raise error on multiple inheritance with NamedTuple (GH-19363) https://github.com/python/cpython/commit/a94e6272f16381349dbed74cdb738e

[issue40182] Remove the _field_types attribute of NamedTuple

2020-04-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : It was deprecated since 3.8 (see issue36320). The __annotations__ attribute has the same information. -- components: Library (Lib) messages: 365780 nosy: gvanrossum, levkivskyi, rhettinger, serhiy.storchaka priority: normal severity: normal

[issue40182] Remove the _field_types attribute of NamedTuple

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18730 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19368 ___ Python tracker <https://bugs.python.org/issu

[issue36320] typing.NamedTuple to switch from OrderedDict to regular dict

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka nosy_count: 4.0 -> 5.0 pull_requests: +18732 pull_request: https://github.com/python/cpython/pull/19370 ___ Python tracker <https://bugs.python.org/issu

[issue40185] Refactor typing.NamedTuple

2020-04-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : typing.NamedTuple is used in two ways. 1. It is a callable which produces a new namedtuple type. 2. It can also be used as a base in the class statement for creating a new namedtuple type. In both cases it is not a real class. You cannot create an

[issue40185] Refactor typing.NamedTuple

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18733 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19371 ___ Python tracker <https://bugs.python.org/issu

[issue40187] Refactor typing.TypedDict

2020-04-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : typing.TypedDict is used in two ways. 1. It is a callable which produces a new pseudo-subtype of dict. 2. It can also be used as a base in the class statement for creating a new pseudo-subtype of dict. In both cases it is not a real class. You cannot

[issue40185] Refactor typing.NamedTuple

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue40187. -- ___ Python tracker <https://bugs.python.org/issue40185> ___ ___ Python-bugs-list mailing list Unsub

[issue40187] Refactor typing.TypedDict

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue40185. -- ___ Python tracker <https://bugs.python.org/issue40187> ___ ___ Python-bugs-list mailing list Unsub

[issue40187] Refactor typing.TypedDict

2020-04-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18734 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19372 ___ Python tracker <https://bugs.python.org/issu

[issue40179] Argument Clinic incorretly translates #elif

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See PR 19360 for real example. -- ___ Python tracker <https://bugs.python.org/issue40179> ___ ___ Python-bugs-list mailin

[issue40180] isinstance(cls_with_metaclass, non_type) raises KeyError

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: All works as expected to me. Your __class__ attribute raise an arbitrary exception, and it is expected, that the code which uses it passes it to you. I am against silencing all exceptions. It may hide bugs. It is even documented. See What's New in P

[issue36320] typing.NamedTuple to switch from OrderedDict to regular dict

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 0d1d7c8bae3f9fe9e937d2931dcbbd3555d1a9f1 by Serhiy Storchaka in branch '3.8': bpo-36320: Use the deprecated-removed directive for _field_types (GH-19370) https://github.com/python/cpython/commit/0d1d7c8bae3f9fe9e937d2931dcbbd

[issue40182] Remove the _field_types attribute of NamedTuple

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6fed3c85402c5ca704eb3f3189ca3f5c67a08d19 by Serhiy Storchaka in branch 'master': bpo-40182: Remove the _field_types attribute of the NamedTuple class (GH-19368) https://github.com/python/cpython/commit/6fed3c85402c5ca704eb3f3189ca3f

[issue40182] Remove the _field_types attribute of NamedTuple

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

[issue40180] isinstance(cls_with_metaclass, non_type) raises KeyError

2020-04-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Sorry, I should have quoted the doc. " If object is not an object of the > given type, the function always returns False." Raising instead is a bug -- > even of the object itself is somewhat buggy. You take it too literally. It doe

[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I get it printed two times. Actually I get it printed four times: two time when compile the test script (use r"'\d'" or "'\\d'" to get rid of them), and other two times when call compile() inside a script. $

[issue40204] Docs build error with Sphinx 3.0 due to invalid C declaration

2020-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Maybe copy the code for deprecated and removed features to Doc/tools/extensions? -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40209] read_pyfile function refactor in Lib/test/test_unparse.py

2020-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can just use open() in binary mode. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be inconvenient to require adding Py_VISIT(Py_TYPE(self)) in all tp_visit implementations of heap allocated types (including third-party extensions). Since tp_visit is GC specific thing, I think it wold be more convenient make a special case for

[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Interesting, this issue may be related to issue24379. The problem with the proposed implementation of subscript was that it created a reference loop, and not all links in this loop were visible by GC

[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Recently many static allocated types were converted to heap allocated types (using PyType_FromSpec). Now you need to add Py_VISIT(Py_TYPE(self)) in all corresponding tp_visit implementations. And since even official example for heap allocated types do not

[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is that we suddenly changed rules. It was not required that the object's type should be visited in tp_visit. It was incorrect to visit it, because object did not have strong reference to its type. User never created it, and it was not cr

[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

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

[issue40185] Refactor typing.NamedTuple

2020-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset a2ec06938f46683e33692615aca3875d8b8e110c by Serhiy Storchaka in branch 'master': bpo-40185: Refactor typing.NamedTuple (GH-19371) https://github.com/python/cpython/commit/a2ec06938f46683e33692615aca387

[issue40187] Refactor typing.TypedDict

2020-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f228bf2300a9d3bf833b1a89336581822e864ae5 by Serhiy Storchaka in branch 'master': bpo-40187: Refactor typing.TypedDict. (GH-19372) https://github.com/python/cpython/commit/f228bf2300a9d3bf833b1a89336581

[issue40187] Refactor typing.TypedDict

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

[issue40185] Refactor typing.NamedTuple

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

[issue40222] "Zero cost" exception handling

2020-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: +1! I was going to implement this, but first I wanted to implement support of line number ranges instead of just line numbers (co_lineno). We need to design some compact portable format for address to address mapping (or address range to address mapping

[issue40228] Make setting line number in frame more robust.

2020-04-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40228> ___ ___ Python-bugs-list mailing list Unsub

[issue40176] unterminated string literal tokenization error messages could be better

2020-04-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I afraid there may be confusion between triple, double and single quoted string literals. So I suggest to change error messages to just "unterminated triple-quoted string literal" and "unterminated string literal" (or "untermin

[issue40202] Misleading grammatically of ValueError Message?

2020-04-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was discussed in issue39816. I do not think that calling len() and ignoring any exception is a good idea. 1. This may silence some exceptions (errors in the __len__ implementation, MemoryError, RecursionError, KeyboardInterrupt) which should not be

[issue40239] Add a function for merging sorted iterables

2020-04-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : It would be useful to have a function in itertools to merge sorted iterables. merge_sorted(*iterables, key=None, reverse=False): It should emit the same items as sorted(tee(*iterables), key=key, reverse=reverse) if iterables are sorted with key and

[issue40239] Add a function for merging sorted iterables

2020-04-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Tim, it is exactly what I need! I got this search result, but I rejected it because it looked obvious that the function from the heapq module cannot have any relation to this. :( I meant chain() instead of tee(), sorry. -- resolution

[issue40225] recursive call within generator expression is O(depth)

2020-04-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +Mark.Shannon, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40225> ___ ___ Python-bugs-list mailin

[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-04-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: How are ipaddress and mmap generic? -- ___ Python tracker <https://bugs.python.org/issue39481> ___ ___ Python-bugs-list m

[issue40249] __import__ doesn't honour globals

2020-04-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: globals is only used when level > 0, to resolve relative names like in `import ..foo`. You have to set keys __package__ and __spec__ or __name__ and __path__ in this case. -- nosy: +serhiy.storchaka ___ Pyt

[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <https://bugs.python.org/issue40

[issue40235] confusing documentation for IOBase.__exit__

2020-04-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I cannot reproduce the issue. __exit__() calls close(). >>> import io >>> class F(io.IOBase): ... def close(self): ... print('close') ... super().close() # set closed = True ... >>> with

[issue39943] Meta: Clean up various issues in C internals

2020-04-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset cd8295ff758891f21084a6a5ad3403d35dda38f7 by Serhiy Storchaka in branch 'master': bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345) https://github.com/python/cpyt

[issue40126] Incorrect error handling in unittest.mock

2020-04-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 4b222c9491d1700e9bdd98e6889b8d0ea1c7321e by Serhiy Storchaka in branch 'master': bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351) https://github.com/python/cpython/commit/4b222c9491d1700e9bdd98e6889b8d

[issue40129] Add test classes for custom __index__, __int__, __float__ and __complex__

2020-04-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39943] Meta: Clean up various issues in C internals

2020-04-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18827 pull_request: https://github.com/python/cpython/pull/19472 ___ Python tracker <https://bugs.python.org/issue39

[issue40257] Improve the use of __doc__ in pydoc

2020-04-11 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently pydoc outputs __doc__ for classes, functions, methods, properties, etc (using inspect.getdoc()). If the object itself does not have non-empty __doc__, it searches non-empty __doc__ in the class parenthesis (if the object is a class) or in the

[issue40257] Improve the use of __doc__ in pydoc

2020-04-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18833 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19479 ___ Python tracker <https://bugs.python.org/issu

[issue40257] Improve the use of __doc__ in pydoc

2020-04-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Inheritance of docstrings was added in issue15582. It works good for class members, but I now realized that doing it for class itself was a mistake. For example: >>> import wave >>> help(wave.Error) Help on class Error in module

[issue40126] Incorrect error handling in unittest.mock

2020-04-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18835 pull_request: https://github.com/python/cpython/pull/19483 ___ Python tracker <https://bugs.python.org/issue40

[issue40126] Incorrect error handling in unittest.mock

2020-04-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18837 pull_request: https://github.com/python/cpython/pull/19484 ___ Python tracker <https://bugs.python.org/issue40

<    23   24   25   26   27   28   29   30   31   32   >