[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 94d6434ba7ec3e4b154e515c5583b0b665ab0b09 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash 
(GH-30283) (GH-30738)
https://github.com/python/cpython/commit/94d6434ba7ec3e4b154e515c5583b0b665ab0b09


--

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is difficult to distinguish Mapping from Sequence because they have the same 
set of dunder methods. The difference is only in semantic -- __iter__ yields 
items for Sequence and keys for Mapping, __getitem__ gets an item by index (or 
a sequence by slice) for Sequence and value by key for Mapping. But semantic 
cannot be tested here.

In these cases when both Sequence and Mapping are accepted but handled 
differently (like in the dict constructor) we test for existence of the "keys" 
method. It is not good, because it is not a dunder method, and therefore should 
be looked up at instance, not only at a type.

--

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Why __class_getitem__ was added in PurePath at first place? PurePath should not 
be a generic class, unlike to os.PathLike. For os.PathLike the type parameters 
represent the returning type of os.fspath() (either str or bytes), but the 
pathlib module only supports paths as strings, so no parametrization is needed.

I think PurePath.__class_getitem__ should be removed.

--
nosy: +gvanrossum, kj, serhiy.storchaka

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



[issue46426] Improve tests for the dir_fd argument

2022-01-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a1015c6478e8cbec2ecb984a3cba733783d168b5 by Miss Islington (bot) 
in branch '3.10':
bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30739)
https://github.com/python/cpython/commit/a1015c6478e8cbec2ecb984a3cba733783d168b5


--

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



[issue46426] Improve tests for the dir_fd argument

2022-01-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28944
pull_request: https://github.com/python/cpython/pull/30757

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



[issue46426] Improve tests for the dir_fd argument

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 54610bb448a9cf5be77d53b66169fca4c11be6cb by Serhiy Storchaka in 
branch 'main':
bpo-46426: Improve tests for the dir_fd argument (GH-30668)
https://github.com/python/cpython/commit/54610bb448a9cf5be77d53b66169fca4c11be6cb


--

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



[issue30512] CAN Socket support for NetBSD

2022-01-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.7

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



[issue30512] CAN Socket support for NetBSD

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 40fcd16889028bd3cd2289e0f8a2af43f17a5824 by Thomas Klausner in 
branch 'main':
bpo-30512: Add CAN Socket support for NetBSD (GH-30066)
https://github.com/python/cpython/commit/40fcd16889028bd3cd2289e0f8a2af43f17a5824


--

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cfadcc31ea84617b1c73022ce54d4ae831333e8d by andrei kulakov in 
branch 'main':
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
https://github.com/python/cpython/commit/cfadcc31ea84617b1c73022ce54d4ae831333e8d


--

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



[issue46425] Multiple test modules fail to run if invoked directly

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 22f73bd9f1fc573d5c998f345b66c29f7ca6614d by Nikita Sobolev in 
branch 'main':
bpo-46425: Fix direct invocation of `test_contextlib` (GH-30681)
https://github.com/python/cpython/commit/22f73bd9f1fc573d5c998f345b66c29f7ca6614d


--

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It may take a time, because the module initialization code has been completely 
rewritten.

--

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



[issue45767] Fix types for dev_t processing in posix module

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is device number -1 used in any context (for example as "unknown device 
number")?

--

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



[issue46444] Wrong value of pi for larger values using math.cos() function

2022-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, math.radians() just multiplies its argument by pi/180.

And what is your issue?

--

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



[issue46444] Wrong value of pi for larger values using math.cos() function

2022-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Arguments of cos() and sin() should be in radians, not in degrees. So the 
correct formulas are k*cos(pi/2-pi/k) and k*sin(pi/k). They are useless because 
to find the pi approximation you need to know pi.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I share concerns of Inada-san. I also think that keeping a status quo (ignoring 
the mapping attribute in typing) is the lesser evil. I am not sure that 
exposing this attribute was a good idea. We do not expose attributes list and 
index for list iterators.

--

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



[issue37295] Possible optimizations for math.comb()

2022-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

comb(n, k) can be computed as perm(n, k) // factorial(k).

$ ./python -m timeit -r1 -n1 -s 'from math import comb' "comb(100, 50)"
recursive: 1 loop, best of 1: 9.16 sec per loop
iterative: 1 loop, best of 1: 164 sec per loop

$ ./python -m timeit -r1 -n1 -s 'from math import perm, factorial' 
"perm(100, 50) // factorial(50)"
recursive: 1 loop, best of 1: 19.8 sec per loop
iterative: 1 loop, best of 1: 137 sec per loop

It is slightly faster than division on every step if use the iterative 
algorithm, but still much slower than the recursive algorithm. And the latter 
if faster if perform many small divisions and keep intermediate results smaller.

--

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



[issue37295] Possible optimizations for math.comb()

2022-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

All this should be tested with the C implementation because relative cost of 
operations is different in C and Python.

I have tested Raymond's idea about using iterative algorithm for small k.

$ ./python -m timeit -s 'from math import comb' "comb(3329023, 3)"
recursive: Mean +- std dev: 173 ns +- 9 ns
iterative: Mean +- std dev: 257 ns +- 13 ns

$ ./python -m pyperf timeit -s 'from math import comb' "comb(102571, 4)"
recursive: Mean +- std dev: 184 ns +- 10 ns
iterative: Mean +- std dev: 390 ns +- 29 ns

$ ./python -m pyperf timeit -s 'from math import comb' "comb(747, 8)"
recursive: Mean +- std dev: 187 ns +- 10 ns
iterative: Mean +- std dev: 708 ns +- 39 ns

Recursive algorithm is always faster than iterative one for k>2 (they are equal 
for k=1 and k=2).

And it is not only because of division, because for perm() we have the same 
difference.

$ ./python -m pyperf timeit -s 'from math import perm' "perm(2642247, 3)"
recursive: Mean +- std dev: 118 ns +- 7 ns
iterative: Mean +- std dev: 147 ns +- 8 ns

$ ./python -m pyperf timeit -s 'from math import perm' "perm(65538, 4)"
recursive: Mean +- std dev: 130 ns +- 9 ns
iterative: Mean +- std dev: 203 ns +- 13 ns

$ ./python -m pyperf timeit -s 'from math import perm' "perm(260, 8)"
recursive: Mean +- std dev: 131 ns +- 10 ns
iterative: Mean +- std dev: 324 ns +- 16 ns

As for the idea about using a table for fixed k=20, note that comb(87, 20) 
exceeds 64 bits, so we will need to use a table of 128-bit integers. And I am 
not sure if this algorithm will be faster than the recursive one.

We may achieve better results for lesser cost if extend Mark's algorithm to use 
128-bit integers. I am not sure whether it is worth, the current code is good 
enough and cover the wide range of cases. Additional optimizations will likely 
have lesser effort/benefit ratio.

--

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



[issue44024] Improve the TypeError message for non-string second arguments passed to the built-in functions getattr and hasattr

2022-01-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you for your contribution Géry.

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

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



[issue44024] Improve the TypeError message for non-string second arguments passed to the built-in functions getattr and hasattr

2022-01-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 16bf9bd157c7bf5f9c60414fa8e0fe5047c55a9b by Géry Ogam in branch 
'main':
bpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)
https://github.com/python/cpython/commit/16bf9bd157c7bf5f9c60414fa8e0fe5047c55a9b


--

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



[issue46045] NetBSD: do not use POSIX semaphores

2022-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 60ceedbdd5b5fb22803039a59954798d931f659a by Thomas Klausner in 
branch 'main':
bpo-46045: Do not use POSIX semaphores on NetBSD (GH-30047)
https://github.com/python/cpython/commit/60ceedbdd5b5fb22803039a59954798d931f659a


--
nosy: +serhiy.storchaka

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



[issue20823] [doc] Clarify copyreg.pickle() documentation

2022-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 65940fa5c12a4b4a0650c7845044ffd63b94e227 by Kumar Aditya in 
branch 'main':
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
https://github.com/python/cpython/commit/65940fa5c12a4b4a0650c7845044ffd63b94e227


--

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



[issue46426] Improve tests for the dir_fd argument

2022-01-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46426] Improve tests for the dir_fd argument

2022-01-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There is a flaw in tests for the dir_fd argument in test_posix. All these tests 
open a current directory as dir_fd, so all paths are relative to the current 
directory. They will pass in case of the following errors:

1. dir_fd, src_dir_fd or dst_dir_fd are completely ignored.
2. The meaning of src_dir_fd and dst_dir_fd is opposite.

The proposed PR rewrites these tests. It is ensure that directory file 
descriptors refer to directories different from the current directory, and that 
src_dir_fd and dst_dir_fd refer to different directories, and that all tested 
filenames are unique, so files cannot be confused with existing diles in 
different directories.

Also add context manager open_dir_fd() in test.support.os_helper. It may be 
helpful in other tests for the dir_fd argument.

--
components: Tests
messages: 410882
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve tests for the dir_fd argument
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue46425] Multiple test modules fail to run if invoked directly

2022-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1292aa6db5bed889a3c87df443754fcae0177801 by Nikita Sobolev in 
branch 'main':
bpo-46425: Fix direct invocation of multiple test modules (GH-30666)
https://github.com/python/cpython/commit/1292aa6db5bed889a3c87df443754fcae0177801


--
nosy: +serhiy.storchaka

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



[issue46393] Generate frozenset constants when explicitly appropriate

2022-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

As Steven have noted the compiler-time optimization is not applicable here 
because name frozenset is resolved at run-time.

In these cases where a set of constants can be replaced with a frozenset of 
constants (in "x in {1,2,3}" and in "for x in {1,2,3}") the compiler does it.

And I don't think there is an issue which is worth changing the language. 
Creating a frozenset of constants is pretty rare, and it is even more rare in 
tight loops. The most common cases (which are pretty rare anyway) are already 
covered.

--

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



[issue46408] signal module wrongly relies on small int singletons

2022-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See msg234768 and issue23325. I propose to close this as a duplicate of 
issue23325.

--
nosy: +serhiy.storchaka

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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +mark.dickinson, rhettinger, stutzbach, tim.peters

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The simplest way of collecting template names is to use a defaultdict:

>>> d = collections.defaultdict(str)
>>> string.Template('$a $b').substitute(d)
' '
>>> d.keys()
dict_keys(['a', 'b'])

You can use a custom mapping if you need special handling of absent keys.

--

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What are the use cases for this feature?

--
nosy: +serhiy.storchaka

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



[issue46312] range() function could accept slice() objects as parameters

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Accepting a slice directly in the range constructor is ambiguous. What to do if 
start or stop are negative or None? What if stop is less than start? You need 
to specify a sequence length to handle these cases.

Maybe the following expressions work for you:

   range(length)[s]

or

   range(*s.indices(length))

But other users may need different behavior (if they want convert slice(-20, 
-10) to range(-20, -10)). There is no general solution which would work for 
all, you have to code what you need.

--
nosy: +rhettinger, serhiy.storchaka

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



[issue37295] Possible optimizations for math.comb()

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2d787971c65b005d0cce219399b9a8e2b70d4ef4 by Serhiy Storchaka in 
branch 'main':
bpo-37295: Use constant-time comb() and perm() for larger n depending on k 
(GH-30305)
https://github.com/python/cpython/commit/2d787971c65b005d0cce219399b9a8e2b70d4ef4


--

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



[issue46304] Unable to iterate over lines in a file without a block of code

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The safe way of using read_lines() is:

lines = read_lines()
try:
# use lines
finally:
lines.close()

or

with contextlib.closing(read_lines()) as lines:
# use lines

And it is in no way better than using "with open()" directly.

I think it is better to not add such sing to the stdlib because it only makes 
an illusion of safety but actually removes safety guards.

If we want using generators in expressions we need to add support for "with" in 
expressions and comprehensions.

data = json.load(f) with open(path, 'rb') as f
lines = (line.strip() for path in files with open(path) as f for line in f)

--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-08 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +vstinner

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



[issue46304] Unable to iterate over lines in a file without a block of code

2022-01-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

A warning is an indication of possible bugs in your code. If you do not close 
file explicitly, and it is closed by the garbage collector, the time of closing 
is undeterminated. This can lead to exhausting of file descriptors if you have 
a lot of opened files waiting for closing in reference loops.

If you want to get rid of warnings, use a corresponding warning filter for 
ignoring specific warnings. Or better rewrite your code in a way that file 
closing is deterministic.

--
nosy: +serhiy.storchaka

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



[issue46293] Typo in specifying escape sequence

2022-01-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, it is a backslash following by a newline.

--
nosy: +serhiy.storchaka

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



[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The CPython source code is irregularly scanned by different code analysis 
tools. The results shown extremely high quality of code in comparison with 
other open source and proprietary code. Most of reports are false positive. 
Last time real bugs (2 or 3) was discovered by tools several years ago, and one 
of these bugs was already known and did have a patch on review.

So while new tools can discover new bugs (unnoticed by previous scans or 
recently added), it is expected that most or all reports be false positive.

--
nosy: +serhiy.storchaka

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



[issue46264] 'I'.lower() should give non dotted i for LANG=tr_TR

2022-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If you are looking for case-insensitive string comparison, look at 
locale.strcoll() and locale.strxfrm(). They are locale-aware.

--
nosy: +serhiy.storchaka

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



[issue34178] test_tcl fails on the 3.7 branch

2022-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was a bug fix. msg320663 states that that issue needs a more complex fix 
than provided by the initial patch. And that more complex fix was applied.

It looks to me that this issue is caused by running new tests with old stdlib. 
Tests caught a bug in an unfixed code, as expected.

--
status: pending -> open

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



[issue44024] Improve the TypeError message for non-string second arguments passed to the built-in functions getattr and hasattr

2022-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good point. That code was originally added in issue420304 because every 
exception raised in PyObject_GetAttr() (including a TypeError for non-string 
name) was silenced in hasattr() and 3-argument getattr(). It was changed in 
Python 3, so this code duplication is no longer needed.

The name of the function was added in error messages in 
a9b9c9fa9fe9d1ae74ba9f89c43557a7f9bc04f5. Now it will gone. It is a minor 
regression, but I think that it is fine. Not all error messages contain a 
function name. In this case the context is clear from the traceback, and the 
error is not specific to these two functions, setattr() and delattr() raise the 
same error.

--
nosy: +serhiy.storchaka

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2022-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

My plan was to fix as much bugs in the stdlib and backport workaround to 3.9 
and 3.10, then propose to revert this "feature" in 3.11.

There is a risk of introducing some regressions by this change, but we can 
handle it. I think it is better to do it now and fix potential bugs in 
third-party code (we cannot add workarounds in all third-party code) than keep 
this weird special case forever.

--

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



[issue46181] Destroying an expaned Combobox prevents Entry focus until Alt+Tab

2022-01-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

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



[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have also almost finished this issue (only needed to add some tests and docs).

--

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



[issue46187] Optionally support rounding for math.isqrt()

2022-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is

   i, rem = isqrt_rem(n)
   i + (rem != 0)

better than

   (isqrt(n<<2) + 1) >> 1

or

   n and isqrt(n-1) + 1

?

As for use cases, there were few cases in my experience when I needed the 
ceiling square root, mostly in simple experiments in REPL, but it was so rary, 
and workarounds satisfied me. So it would be a nice to have feature which I 
would use perhaps once in a year or two years, but can live without it. And I 
do not want to pay a cost of significantly complicating API or slowing down 
isqrt().

--
nosy: +serhiy.storchaka

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



[issue46245] Add support for dir_fd in shutil.rmtree()

2022-01-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am sorry, I implemented this feature before opening this issue, but due to 
typo the PR was not linked here.

--

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



[issue46245] Add support for dir_fd in shutil.rmtree()

2022-01-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28596
pull_request: https://github.com/python/cpython/pull/30365

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



[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-01-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Add support for dir_fd in shutil.rmtree()

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



[issue46245] Add support for dir_fd in shutil.rmtree()

2022-01-03 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

It is necessary in particularly for supporting dir_fd in the tempfile module 
(issue25927).

--
components: Library (Lib)
messages: 409599
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add support for dir_fd in shutil.rmtree()
type: enhancement
versions: Python 3.11

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



[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-01-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it is better to not change posixpath for now. And it is not necessary. 
But shutil.rmtree() needs to support file descriptors, and it is not trivial 
issue.

--

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



[issue34931] os.path.splitext with more dots

2022-01-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Well, so we can keep term "extension". But I think it is worth to clarify that 
"leading periods" is related to the last component, not the whole path. It is 
related to the original issue.

--

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



[issue34931] os.path.splitext with more dots

2022-01-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are other issues with the documentation of splitext().

1. It uses term "extension" (it is even a part of function name), but it is 
vague and usually does not include a period. On Windows the extension of 
"python.exe" is "exe", not ".exe". On Unix term "suffix" is commonly used, 
".exe" is a suffix. It is also used in pathlib. I suggest to replace 
"extension" with "suffix".

2. It is not specified that only the part of the last path component is 
included in the suffix, and leading periods of the last path component are 
ignored, not just leading periods of the path. So splitext('mail.dir/') == 
('mail.dir/', '') and splitext('/home/user/.etc') is ('/home/user/.etc', ''). 
It is not documented that splitext() works with multi-component paths at all.

--
nosy: +pitrou

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



[issue46142] python --help output is too long

2021-12-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that the man page should contain all details related to the CLI (and 
may be even some examples).

--

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



[issue37295] Possible optimizations for math.comb()

2021-12-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 30305 applies Mark's algorithm for larger n (up to 127) depending on k, as 
was suggested by Raymond. Note that it uses different table for limits, which 
maps k to maximal n.

--

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



[issue37295] Possible optimizations for math.comb()

2021-12-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28518
pull_request: https://github.com/python/cpython/pull/30305

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



[issue46189] Text containing "wide" character not correctly refreshed

2021-12-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

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



[issue34498] Python 3.7+ break on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2021-12-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

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



[issue46200] Discourage logging f-strings due to security considerations

2021-12-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +vinay.sajip

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-12-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 8d7644fa64213207b8dc6f555cb8a02bfabeced2 by andrei kulakov in 
branch 'main':
bpo-45853: Fix misspelling and unused import in pathlib (GH-30292)
https://github.com/python/cpython/commit/8d7644fa64213207b8dc6f555cb8a02bfabeced2


--

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



[issue46191] Conflict between using annotations in singledispatch() and MyPy

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Okay. As a workaround we can explicitly specify the dispatching type:

@f.register(list)
def _(a: list[int]) -> None:
pass

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

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



[issue37295] Possible optimizations for math.comb()

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think Raymond means extending the tables to TableSize=101. It can benefit 
larger arguments if move the code in perm_comb_small(). And perhaps loops in 
perm_comb_small() could be optimized by using precalculated values for some 
products.

--

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



[issue46191] Conflict between using annotations in singledispatch() and MyPy

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think there is a problem in MyPy. What if use __origin__ for 
dispatching? Registering with parametrized generics with the same __origin__ 
will be error.

@sigledispatch
def f(a: int) -> None:
pass

@f.register  # ok
def _(a: list[int]) -> None:
pass

@f.register  # runtime error
def _(a: list[str]) -> None:
pass

@f.register  # runtime error
def _(a: list) -> None:
pass

f(1)  # ok
f([1])  # ok
f([])  # ok
f(['abc'])  # static type checking error

I think that it will have advantage of stronger static type checking.

--

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



[issue45853] Misspelled _IGNORED_ERROS in Lib/pathlib.py

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was assigned to a variable initially because it was used in multiple places. 
Now it is only used in one place, but I agree with keeping the variable for 
readability.

But it should be named _IGNORED_ERRNOS.

--

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



[issue34498] Python 3.7+ break on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2021-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The original issue is about dispatching on non-parametrized generics like 
typing.Sequence. isinstance([], typing.Sequence) works, so it could be possible 
to support dispatching on typing.Sequence. But I have doubts that it is worth 
to revive such feature, because it needs some effort, and you can use 
collections.abc.Sequence instead.

But there is a conflict between using annotations in singledispatch() and MyPy 
(issue46191).

--

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



[issue46191] Conflict between using annotations in singledispatch() and MyPy

2021-12-29 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

You can dispatch on collections.abc.Sequence.

@functools.singledispatch
def f(a: collections.abc.Sequence) -> None:
pass

But MyPy complains about this:

error: Missing type parameters for generic type "Sequence"

MyPy requires parametrized generic (like collections.abc.Sequence[int]), but 
singledispatch() does not work with it.

--
components: Library (Lib)
messages: 409295
nosy: gvanrossum, kj, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Conflict between using annotations in singledispatch() and MyPy
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2021-12-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Well, the tar command strips trailing slashes (even from file paths), so it is 
reasonable to do this in getmember().

$ mkdir dir
$ touch dir/file
$ tar cf archive.tar dir
$ tar tf archive.tar dir
dir/
dir/file
$ tar tf archive.tar dir/
dir/
dir/file
$ tar tf archive.tar dir/file
dir/file
$ tar tf archive.tar dir/file/
dir/file
$ tar tf archive.tar dir/file
dir/file

--

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Josh. super() uses a lot of magic, and in case of comprehensions 
it fails in interesting way.

Most common cases in which super() does not work:

1. Outside of a function defined in a class.
2. In a static method.
3. In inner function.
4. In comprehensions and generator expressions.

Idea #2 could help in cases 3 and 4.

--

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



[issue34963] String representation for types created with typing.NewType(…) are opaque and unappealing

2021-12-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

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



[issue45496] Tkinter: test_winfo_rgb failure

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed

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



[issue45496] Tkinter: test_winfo_rgb failure

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 25a12aac4de819745dfc64664ba183a5784b5a81 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-46032: Check types in singledispatch's register() at declaration time 
(GH-30050) (GH-30254) (GH-30255)
https://github.com/python/cpython/commit/25a12aac4de819745dfc64664ba183a5784b5a81


--

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



[issue23819] test_asyncio fails when run under -O

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 07229054a129a72b4ffdf29252eb73c6154c0ccf by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) 
(GH-30265)
https://github.com/python/cpython/commit/07229054a129a72b4ffdf29252eb73c6154c0ccf


--

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



[issue45496] Tkinter: test_winfo_rgb failure

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2e3e0d23adca8d83722d939d6abd1e467d7578f7 by E-Paine in branch 
'main':
bpo-45496: Allow flexibility in winfo_rgb tests (GH-30185)
https://github.com/python/cpython/commit/2e3e0d23adca8d83722d939d6abd1e467d7578f7


--

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



[issue43413] tuple subclasses allow arbitrary kwargs

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ad4857884b4821fc2c9bd23b63d03f9570eb03d1 by Serhiy Storchaka in 
branch 'main':
bpo-43413: Revert changes in set.__init__ (GH-28403)
https://github.com/python/cpython/commit/ad4857884b4821fc2c9bd23b63d03f9570eb03d1


--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset bee660e46ae2a051400177dcd758d95b5b4a6fcc by Miss Islington (bot) 
in branch '3.9':
[3.9] Remove a NEWS entry for bpo-45878 (GH-30258) (GH-30260)
https://github.com/python/cpython/commit/bee660e46ae2a051400177dcd758d95b5b4a6fcc


--

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



[issue22815] unexpected successes are not output

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue22815] unexpected successes are not output

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1944434b44e0118e812bf63f47b268ff6dd0c8f1 by Serhiy Storchaka in 
branch 'main':
bpo-22815: Print unexpected successes in summary in TextTestResult (GH-30138)
https://github.com/python/cpython/commit/1944434b44e0118e812bf63f47b268ff6dd0c8f1


--

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



[issue45321] Module xml.parsers.expat.errors misses error code constants of libexpat >=2.0

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +eli.bendersky, scoder

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



[issue23819] test_asyncio fails when run under -O

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a23ab7b6d8b3ae3a47747c0c4bceb2370cc48dcc by Kumar Aditya in 
branch 'main':
bpo-23819: Fix asyncio tests on python optimized mode (GH-30195)
https://github.com/python/cpython/commit/a23ab7b6d8b3ae3a47747c0c4bceb2370cc48dcc


--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1fb7c61ca76c6fbff4d90b272e34e92bc2c7d729 by Serhiy Storchaka in 
branch 'main':
Remove a NEWS entry for bpo-45878 (GH-30259)
https://github.com/python/cpython/commit/1fb7c61ca76c6fbff4d90b272e34e92bc2c7d729


--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 11909c12c75a7f377460561abc97707a4006fc07 by Serhiy Storchaka in 
branch '3.10':
[3.10] Remove a NEWS entry for bpo-45878 (GH-30258)
https://github.com/python/cpython/commit/11909c12c75a7f377460561abc97707a4006fc07


--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28480
pull_request: https://github.com/python/cpython/pull/30259

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28479
pull_request: https://github.com/python/cpython/pull/30258

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 03c7449fbc7c57f5e0365f234a0b65c1dde763f2 by Serhiy Storchaka in 
branch '3.10':
[3.10] bpo-46032: Check types in singledispatch's register() at declaration 
time (GH-30050) (GH-30254)
https://github.com/python/cpython/commit/03c7449fbc7c57f5e0365f234a0b65c1dde763f2


--

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28475
pull_request: https://github.com/python/cpython/pull/30254

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 078abb676cf759b1e960f78390b6e80f256f0255 by Serhiy Storchaka in 
branch 'main':
bpo-46032: Check types in singledispatch's register() at declaration time 
(GH-30050)
https://github.com/python/cpython/commit/078abb676cf759b1e960f78390b6e80f256f0255


--

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



[issue40296] help(list[int]) fails

2021-12-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue45865] Old syntax in unittest

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Not worth the hassle.

--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a9e0b2b49374df91c40fe409508cfcdc6332450e by Miss Islington (bot) 
in branch '3.10':
bpo-45878: convert `try/except` to `self.assertRaises` in 
`Lib/ctypes/test/test_functions.py` (GH-29721) (GH-29748)
https://github.com/python/cpython/commit/a9e0b2b49374df91c40fe409508cfcdc6332450e


--

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 393ff040281db818f2d6e0240919316f58f989a6 by Miss Islington (bot) 
in branch '3.9':
bpo-45878: convert `try/except` to `self.assertRaises` in 
`Lib/ctypes/test/test_functions.py` (GH-29721) (GH-29723)
https://github.com/python/cpython/commit/393ff040281db818f2d6e0240919316f58f989a6


--

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



[issue46167] Parse assert (x == y, "Descriptive text") as statement params instead of a tuple

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For very long expression or very long message you can add parentheses around 
the expression or message. Black will format it as:

assert (
very very long
expression
), (
"very very long "
"message"
)

With the proposed feature it will be:

assert (
very very long
expression,
"very very long "
"message",
)

It saves one line, but the border between an expression and a message is blur. 
Since they are separated by a comma at the end of line and all lines have the 
same indentation it looks less readable to me.

Note also that Black adds a comma after message.

--

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



[issue46162] Make `builtins.property` generic

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Does it mean that property[GetType, SetType] will be required and MyPy will 
complain if the raw property decorator be used?

--
nosy: +serhiy.storchaka

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



[issue46167] Parse assert (x == y, "Descriptive text") as statement params instead of a tuple

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It does not need any change in parser, it can be done in the code generator 
which currently explicitly warns about such ambiguity.

Although it needs changes in formal grammar which will be more complex.

But what is a benefit? What is an advantage of writing

   assert (thing, description)

instead of

   assert thing, description

?

--
nosy: +gvanrossum, serhiy.storchaka

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 30237 introduced few new errors.

--

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
versions: +Python 3.10, Python 3.11, Python 3.9

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And more errors can be found with:

$ find -name '*.rst' -exec egrep --color -i '\ban +[qwrtpsdfghjklzxcvbnm]' '{}' 
+
$ find -name '*.rst' -exec egrep --color -i '\ba +[eioa]' '{}' +

It is worth to check also:

$ find -name '*.rst' -exec egrep --color -i '\ban +[yu]' '{}' +
$ find -name '*.rst' -exec egrep --color -i '\ba +[yu]' '{}' +

Most of them should be correct, but there may be some new errors.

--

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Kumar.

These errors were found with the following one-liners:

$ find -name '*.rst' -exec egrep --color -i '\ban 
+:[a-z:]+:`[qwrtpsdfghjklzxcvbnm]' '{}' +
$ find -name '*.rst' -exec egrep --color -i '\ba +:[a-z:]+:`[eyuioa]' '{}' +

They produce a lot of false positive results because of signatures and 
different reading of initial "y" and "u" (and "o", but there are no such cases 
here).

--

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Doc/using/cmdline.rst:474:   * ``-X warn_default_encoding`` issues a 
:class:`EncodingWarning` when the
Doc/c-api/init_config.rst:601:  If non-zero, emit a :exc:`EncodingWarning` 
warning when :class:`io.TextIOWrapper`
Doc/library/fractions.rst:90:  and *denominator*. :func:`math.gcd` always 
return a :class:`int` type.
Doc/library/asyncio-future.rst:122:  a :exc:`InvalidStateError` exception.
Doc/library/asyncio-future.rst:128:  Raises a :exc:`InvalidStateError` 
error if the Future is
Doc/library/asyncio-future.rst:135:  Raises a :exc:`InvalidStateError` 
error if the Future is
Doc/library/inspect.rst:402:  wrapped function is a :term:`asynchronous 
generator` function.
Doc/library/importlib.rst:881:   Returns a 
:class:`importlib.abc.Traversable` object for the loaded
Doc/library/importlib.rst:960:Given a 
:class:`importlib.resources.abc.Traversable` object representing
Doc/library/pathlib.rst:721:   Return a :class:`os.stat_result` object 
containing information about this path, like :func:`os.stat`.
Doc/library/os.rst:3412:   Provide semaphore-like semantics for reads from a 
:func:`eventfd` file
Doc/library/asyncio-task.rst:947:  a :exc:`InvalidStateError` exception.
Doc/library/ast.rst:782:   be a :class:`Name`, a :class:`Attribute` or a 
:class:`Subscript`.
Doc/library/ast.rst:1772:   must be wrapped in a :class:`Expr` node if the 
value sent back is not used.
Doc/library/asyncio-eventloop.rst:116:   is implicitly scheduled to run as a 
:class:`asyncio.Task`.
Doc/library/asyncio-eventloop.rst:357:   must return a 
:class:`asyncio.Future`-compatible object.
Doc/library/asyncio-eventloop.rst:1129:   This method returns a 
:class:`asyncio.Future` object.
Doc/glossary.rst:113:  An object created by a :term:`asynchronous 
generator` function.
Doc/reference/expressions.rst:216:clause may be used to iterate over a 
:term:`asynchronous iterator`.
Doc/reference/expressions.rst:710:   This method is normally called implicitly 
by a :keyword:`async for` loop.
Doc/whatsnew/3.7.rst:607:a :class:`importlib.abc.ResourceReader` instance to 
support this
Misc/NEWS.d/3.10.0a1.rst:825:``True``, ``False`` and ``None`` are used within a 
:class:`ast.Name` node.
Misc/NEWS.d/3.9.0a4.rst:407:always return a :class:`int` type. Previously, the 
GCD type depended on
Misc/NEWS.d/3.9.0b1.rst:394:When a :class:`asyncio.Task` is cancelled, the 
exception traceback now

--

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



[issue46157] Typo in JSON documentation

2021-12-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are other similar errors:

Doc/library/json.rst:162:   will result in an :exc:`RecursionError` (or worse).
Doc/library/json.rst:435:   prevent an infinite recursion (which would cause an 
:exc:`RecursionError`).
Doc/library/tarfile.rst:66:   |  | Raise an 
:exc:`FileExistsError` exception   |
Doc/library/tarfile.rst:70:   |  | Raise an 
:exc:`FileExistsError` exception   |
Doc/library/tarfile.rst:74:   |  | Raise an 
:exc:`FileExistsError` exception   |
Doc/library/tarfile.rst:78:   |  | Raise an 
:exc:`FileExistsError` exception   |
Doc/library/poplib.rst:124:An :class:`POP3` instance has the following methods:
Doc/library/urllib.request.rst:1112:   implementation will raise an 
:exc:`ValueError` in that case.
Doc/library/enum.rst:180:  Returns the Enum member in *cls* matching 
*name*, or raises an :exc:`KeyError`::
Doc/library/os.rst:2084:   If *exist_ok* is ``False`` (the default), an 
:exc:`FileExistsError` is
Doc/library/os.rst:2360:   not empty, an :exc:`FileNotFoundError` or an 
:exc:`OSError` is raised
Doc/library/asyncio-eventloop.rst:900:  method, before Python 3.7 it 
returned an :class:`Future`.
Doc/library/asyncio-eventloop.rst:1085:   The *executor* argument should be an 
:class:`concurrent.futures.Executor`
Doc/whatsnew/3.9.rst:700::pep:`593` introduced an :data:`typing.Annotated` type 
to decorate existing

--
nosy: +serhiy.storchaka

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



<    1   2   3   4   5   6   7   8   9   10   >