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
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
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
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
Change by Serhiy Storchaka :
--
pull_requests: +28944
pull_request: https://github.com/python/cpython/pull/30757
___
Python tracker
<https://bugs.python.org/issue46
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
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.or
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
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
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
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/issue23
Serhiy Storchaka added the comment:
Is device number -1 used in any context (for example as "unknown device
number")?
--
___
Python tracker
<https://bugs.python.o
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/issue46
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
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
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
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(33
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.or
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
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 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
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/issu
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
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
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 "
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/issue46
Change by Serhiy Storchaka :
--
nosy: +mark.dickinson, rhettinger, stutzbach, tim.peters
___
Python tracker
<https://bugs.python.org/issue46407>
___
___
Pytho
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 i
Serhiy Storchaka added the comment:
What are the use cases for this feature?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
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
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
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
Change by Serhiy Storchaka :
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue46303>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Serhiy Storchaka added the comment:
No, it is a backslash following by a newline.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
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
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/issue46
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
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
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
Change by Serhiy Storchaka :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/issue25
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 experim
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/issue46
Change by Serhiy Storchaka :
--
pull_requests: +28596
pull_request: https://github.com/python/cpython/pull/30365
___
Python tracker
<https://bugs.python.org/issue46
Change by Serhiy Storchaka :
--
dependencies: +Add support for dir_fd in shutil.rmtree()
___
Python tracker
<https://bugs.python.org/issue25927>
___
___
Pytho
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
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.
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.
--
__
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 "
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/issue46
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
<ht
Change by Serhiy Storchaka :
--
pull_requests: +28518
pull_request: https://github.com/python/cpython/pull/30305
___
Python tracker
<https://bugs.python.org/issue37
Change by Serhiy Storchaka :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> wont fix
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue46200>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 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
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
__
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
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]) ->
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
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
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 paramet
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
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
Change by Serhiy Storchaka :
--
resolution: -> out of date
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> fixed
___
Python tracker
<https://bugs.python.org/issue45496>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Serhiy Storchaka :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue45496>
___
___
Pyth
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 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
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
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
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
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
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 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
Change by Serhiy Storchaka :
--
nosy: +eli.bendersky, scoder
___
Python tracker
<https://bugs.python.org/issue45321>
___
___
Python-bugs-list mailing list
Unsub
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
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
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
Change by Serhiy Storchaka :
--
pull_requests: +28480
pull_request: https://github.com/python/cpython/pull/30259
___
Python tracker
<https://bugs.python.org/issue45
Change by Serhiy Storchaka :
--
pull_requests: +28479
pull_request: https://github.com/python/cpython/pull/30258
___
Python tracker
<https://bugs.python.org/issue45
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
Change by Serhiy Storchaka :
--
pull_requests: +28475
pull_request: https://github.com/python/cpython/pull/30254
___
Python tracker
<https://bugs.python.org/issue46
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
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/issu
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46175>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
Not worth the hassle.
--
___
Python tracker
<https://bugs.python.org/issue45865>
___
___
Python-bugs-list mailing list
Unsub
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
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
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
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/issue46
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
Serhiy Storchaka added the comment:
PR 30237 introduced few new errors.
--
___
Python tracker
<https://bugs.python.org/issue46157>
___
___
Python-bugs-list m
Change by Serhiy Storchaka :
--
versions: +Python 3.10, Python 3.11, Python 3.9
___
Python tracker
<https://bugs.python.org/issue46157>
___
___
Python-bugs-list m
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
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
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
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
301 - 400 of 25750 matches
Mail list logo